diff options
| author | Russ White <russ@riw.us> | 2023-03-21 10:12:01 -0400 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-21 10:12:01 -0400 | 
| commit | 2c50f65f1cd205de75c3235066e36bbf60cdf9d1 (patch) | |
| tree | df8cc99008dfe0538a7d3a818bbf107c81dfa332 | |
| parent | 2e1ea892220dccb8a4c72e438cb3bbd4cac22b2b (diff) | |
| parent | 5b498ae7ecc58ff6e9afa74bbf3715aee1332d52 (diff) | |
Merge pull request #12968 from pguibert6WIND/asn_aggregator_counter_prop
yang: Fix "aggregator-asn" to support asdot
| -rw-r--r-- | bgpd/bgp_routemap_nb_config.c | 10 | ||||
| -rw-r--r-- | yang/frr-bgp-route-map.yang | 27 | 
2 files changed, 32 insertions, 5 deletions
diff --git a/bgpd/bgp_routemap_nb_config.c b/bgpd/bgp_routemap_nb_config.c index 142bded6c5..4db8dba2cc 100644 --- a/bgpd/bgp_routemap_nb_config.c +++ b/bgpd/bgp_routemap_nb_config.c @@ -2628,8 +2628,18 @@ int  lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_asn_modify(  	struct nb_cb_modify_args *args)  { +	const char *asn; +	enum match_type match; +  	switch (args->event) {  	case NB_EV_VALIDATE: +		asn = yang_dnode_get_string(args->dnode, NULL); +		if (!asn) +			return NB_ERR_VALIDATION; +		match = asn_str2asn_match(asn); +		if (match == exact_match) +			return NB_OK; +		return NB_ERR_VALIDATION;  	case NB_EV_PREPARE:  	case NB_EV_ABORT:  	case NB_EV_APPLY: diff --git a/yang/frr-bgp-route-map.yang b/yang/frr-bgp-route-map.yang index 8e288194ec..90163f125e 100644 --- a/yang/frr-bgp-route-map.yang +++ b/yang/frr-bgp-route-map.yang @@ -474,6 +474,27 @@ module frr-bgp-route-map {        "ext-community link bandwidth types.";    } +  typedef asn-type { +    type union { +      type uint32 { +        range "1..4294967295"; +      } +      type string { +        pattern '(0|[1-9][0-9]{0,3}|[1-5][0-9]{4}|' +        +  '6[0-4][0-9]{3}|65[0-4][0-9]{2}|' +        +  '655[0-2][0-9]|6553[0-5])\.' +        +  '(0|[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|' +        +  '65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])' { +          error-message "AS dot should be in the form [0..65535].[0..65535]."; +        } +        pattern '^0\.0$' { +          modifier "invert-match"; +          error-message "AS dot can't be equal to 0.0."; +        } +      } +    } +  } +    augment "/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:match-condition/frr-route-map:rmap-match-condition/frr-route-map:match-condition" {      case local-preference {        when "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-local-preference')"; @@ -1004,16 +1025,12 @@ module frr-bgp-route-map {        when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'frr-bgp-route-map:aggregator')";        container aggregator {          leaf aggregator-asn { -          type uint32 { -            range "1..4294967295"; -          } +          type asn-type;            description              "ASN of the aggregator";          }          leaf aggregator-address { -          when "../aggregator-asn > 0 or " -             + "../aggregator-asn <= 4294967295";            type inet:ipv4-address;            description              "IPv4 address of the aggregator";  | 
