]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd, yang: fix missing mandatory/default statements on some leafs 15428/head
authorIgor Ryzhov <iryzhov@nfware.com>
Sun, 25 Feb 2024 19:50:41 +0000 (21:50 +0200)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Mon, 26 Feb 2024 07:44:44 +0000 (07:44 +0000)
The code expects these leafs to always exist. If they are not set, the
daemon would crash. CLI always sets them, but we should properly mark
them as mandatory/default to prevent them from being missed when using
the API.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 83a3b0f10f994ee5adbbef0f6bd970b69eab4486)

bgpd/bgp_routemap_nb.c
bgpd/bgp_routemap_nb.h
bgpd/bgp_routemap_nb_config.c
yang/frr-bgp-route-map.yang

index 2320d2f9084eb548db381935ad1d597cab12fc87..096502aaa9046536e669387afd1e82c86508d9fa 100644 (file)
@@ -156,7 +156,6 @@ const struct frr_yang_module_info frr_bgp_route_map_info = {
                        .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:comm-list/comm-list-name",
                        .cbs = {
                                .modify = lib_route_map_entry_match_condition_rmap_match_condition_comm_list_comm_list_name_modify,
-                               .destroy = lib_route_map_entry_match_condition_rmap_match_condition_comm_list_comm_list_name_destroy,
                        }
                },
                {
@@ -367,14 +366,12 @@ const struct frr_yang_module_info frr_bgp_route_map_info = {
                        .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:aggregator/aggregator-asn",
                        .cbs = {
                                .modify = lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_asn_modify,
-                               .destroy = lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_asn_destroy,
                        }
                },
                {
                        .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:aggregator/aggregator-address",
                        .cbs = {
                                .modify = lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_address_modify,
-                               .destroy = lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_address_destroy,
                        }
                },
                {
@@ -403,7 +400,6 @@ const struct frr_yang_module_info frr_bgp_route_map_info = {
                        .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-lb/lb-type",
                        .cbs = {
                                .modify = lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_lb_type_modify,
-                               .destroy = lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_lb_type_destroy,
                        }
                },
                {
@@ -424,7 +420,6 @@ const struct frr_yang_module_info frr_bgp_route_map_info = {
                        .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-lb/two-octet-as-specific",
                        .cbs = {
                                .modify = lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_two_octet_as_specific_modify,
-                               .destroy = lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_two_octet_as_specific_destroy,
                        }
                },
                {
index 00c1bde62ab44dea64a5da1932fc27f1b80fbe19..d7f0cea30ea0a6ec551d88eecc8443844349865b 100644 (file)
@@ -66,7 +66,6 @@ int lib_route_map_entry_match_condition_rmap_match_condition_comm_list_destroy(
        struct nb_cb_destroy_args *args);
 void lib_route_map_entry_match_condition_rmap_match_condition_comm_list_finish(struct nb_cb_apply_finish_args *args);
 int lib_route_map_entry_match_condition_rmap_match_condition_comm_list_comm_list_name_modify(struct nb_cb_modify_args *args);
-int lib_route_map_entry_match_condition_rmap_match_condition_comm_list_comm_list_name_destroy(struct nb_cb_destroy_args *args);
 int lib_route_map_entry_match_condition_rmap_match_condition_comm_list_comm_list_name_exact_match_modify(struct nb_cb_modify_args *args);
 int lib_route_map_entry_match_condition_rmap_match_condition_comm_list_comm_list_name_exact_match_destroy(struct nb_cb_destroy_args *args);
 int lib_route_map_entry_match_condition_rmap_match_condition_comm_list_comm_list_name_any_modify(
@@ -137,9 +136,7 @@ int lib_route_map_entry_set_action_rmap_set_action_aggregator_destroy(
        struct nb_cb_destroy_args *args);
 void lib_route_map_entry_set_action_rmap_set_action_aggregator_finish(struct nb_cb_apply_finish_args *args);
 int lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_asn_modify(struct nb_cb_modify_args *args);
-int lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_asn_destroy(struct nb_cb_destroy_args *args);
 int lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_address_modify(struct nb_cb_modify_args *args);
-int lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_address_destroy(struct nb_cb_destroy_args *args);
 int lib_route_map_entry_set_action_rmap_set_action_comm_list_num_modify(struct nb_cb_modify_args *args);
 int lib_route_map_entry_set_action_rmap_set_action_comm_list_num_destroy(struct nb_cb_destroy_args *args);
 int lib_route_map_entry_set_action_rmap_set_action_comm_list_num_extended_modify(struct nb_cb_modify_args *args);
@@ -152,11 +149,9 @@ int lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_destroy(
        struct nb_cb_destroy_args *args);
 void lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_finish(struct nb_cb_apply_finish_args *args);
 int lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_lb_type_modify(struct nb_cb_modify_args *args);
-int lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_lb_type_destroy(struct nb_cb_destroy_args *args);
 int lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_bandwidth_modify(struct nb_cb_modify_args *args);
 int lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_bandwidth_destroy(struct nb_cb_destroy_args *args);
 int lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_two_octet_as_specific_modify(struct nb_cb_modify_args *args);
-int lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_two_octet_as_specific_destroy(struct nb_cb_destroy_args *args);
 int lib_route_map_entry_set_action_rmap_set_action_extcommunity_none_modify(
        struct nb_cb_modify_args *args);
 int lib_route_map_entry_set_action_rmap_set_action_extcommunity_none_destroy(
index e7b4fa6a7ebfbb5627caf7d8b33f587893690dc8..c1d6ee12e147cae4f0a900e7a2821fa8e5266121 100644 (file)
@@ -1232,22 +1232,6 @@ lib_route_map_entry_match_condition_rmap_match_condition_comm_list_comm_list_nam
        return NB_OK;
 }
 
-int
-lib_route_map_entry_match_condition_rmap_match_condition_comm_list_comm_list_name_destroy(
-       struct nb_cb_destroy_args *args)
-{
-       switch (args->event) {
-       case NB_EV_VALIDATE:
-       case NB_EV_PREPARE:
-       case NB_EV_ABORT:
-       case NB_EV_APPLY:
-               break;
-       }
-
-       return NB_OK;
-
-}
-
 /*
  * XPath:
  * /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:comm-list/comm-list-name-any
@@ -2838,21 +2822,6 @@ lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_asn_modify(
        return NB_OK;
 }
 
-int
-lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_asn_destroy(
-       struct nb_cb_destroy_args *args)
-{
-       switch (args->event) {
-       case NB_EV_VALIDATE:
-       case NB_EV_PREPARE:
-       case NB_EV_ABORT:
-       case NB_EV_APPLY:
-               break;
-       }
-
-       return NB_OK;
-}
-
 /*
  * XPath:
  * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:aggregator/aggregator-address
@@ -2872,21 +2841,6 @@ lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_address_mod
        return NB_OK;
 }
 
-int
-lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_address_destroy(
-       struct nb_cb_destroy_args *args)
-{
-       switch (args->event) {
-       case NB_EV_VALIDATE:
-       case NB_EV_PREPARE:
-       case NB_EV_ABORT:
-       case NB_EV_APPLY:
-               break;
-       }
-
-       return NB_OK;
-}
-
 /*
  * XPath:
  * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:comm-list-name
@@ -3031,13 +2985,6 @@ lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_lb_type_modify(
        return NB_OK;
 }
 
-int
-lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_lb_type_destroy(
-               struct nb_cb_destroy_args *args)
-{
-       return NB_OK;
-}
-
 /*
  * XPath:
  * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-lb/bandwidth
@@ -3119,13 +3066,6 @@ lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_two_octet_as_spec
        return NB_OK;
 }
 
-int
-lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_two_octet_as_specific_destroy(
-       struct nb_cb_destroy_args *args)
-{
-       return NB_OK;
-}
-
 /*
  * XPath:
  * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-none
index c50c51389eca2427b062543b567015ad90d46bac..c679f3b9118732042d148d3d4ba07c15de1306c5 100644 (file)
@@ -379,6 +379,7 @@ identity set-extcommunity-color {
   grouping extcommunity-non-transitive-types {
     leaf two-octet-as-specific {
       type boolean;
+      default false;
       description
         "Non-Transitive Two-Octet AS-Specific Extended Community";
     }
@@ -769,6 +770,7 @@ identity set-extcommunity-color {
         + "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:match-condition/frr-route-map:condition, 'frr-bgp-route-map:match-extcommunity')";
       container comm-list {
         leaf comm-list-name {
+          mandatory true;
           type bgp-filter:bgp-list-name;
         }
 
@@ -872,11 +874,13 @@ identity set-extcommunity-color {
         description
           "Value of the ext-community.";
         leaf lb-type {
+          mandatory true;
           type frr-bgp-route-map:extcommunity-lb-type;
         }
 
         leaf bandwidth {
           when "../lb-type = 'explicit-bandwidth'";
+          mandatory true;
           type uint16 {
             range "1..25600";
           }
@@ -1108,12 +1112,14 @@ identity set-extcommunity-color {
       container aggregator {
         leaf aggregator-asn {
           type asn-type;
+          mandatory true;
           description
             "ASN of the aggregator";
         }
 
         leaf aggregator-address {
           type inet:ipv4-address;
+          mandatory true;
           description
             "IPv4 address of the aggregator";
         }