diff options
62 files changed, 760 insertions, 589 deletions
diff --git a/.github/commitlint.config.js b/.github/commitlint.config.js new file mode 100644 index 0000000000..cf7daab867 --- /dev/null +++ b/.github/commitlint.config.js @@ -0,0 +1,44 @@ +module.exports = { +	rules: { +		'header-max-length': [2, 'always', 72], +		'type-case': [2, 'always', 'lower-case'], +		'type-empty': [2, 'never'], +		'type-enum': [ +			2, +			'always', +			[ +				'babeld', +				'bfdd', +				'bgpd', +				'doc', +				'docker', +				'eigrpd', +				'fpm', +				'isisd', +				'ldpd', +				'lib', +				'multi', +				'nhrpd', +				'ospf6d', +				'ospfd', +				'pbrd', +				'pimd', +				'pim6d', +				'ripd', +				'ripngd', +				'sharpd', +				'staticd', +				'tests', +				'tools', +				'vtysh', +				'vrrpd', +				'yang', +				'zebra', +				'all', +			], +		], +		'subject-empty': [2, 'never'], +		'subject-full-stop': [2, 'never', '.'], +		'subject-case': [2, 'always', 'sentence-case'], +	}, +}; diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml new file mode 100644 index 0000000000..a1f273a2ce --- /dev/null +++ b/.github/workflows/commitlint.yml @@ -0,0 +1,19 @@ +name: commitlint + +on: +  pull_request_target: +    types: +      - opened +      - reopened + +jobs: +  lint: +    if: github.repository == 'frrouting/frr' +    permissions: +      contents: read +    runs-on: ubuntu-latest +    steps: +      - name: Check Commit +        uses: wagoid/commitlint-github-action@v5 +        with: +          configFile: .github/commitlint.config.js diff --git a/babeld/babel_filter.c b/babeld/babel_filter.c index 731ad1ba8b..f49fee8dae 100644 --- a/babeld/babel_filter.c +++ b/babeld/babel_filter.c @@ -44,15 +44,18 @@ babel_filter(int output, const unsigned char *prefix, unsigned short plen,      struct prefix_list *plist;      int distribute;      struct babel *babel; +    afi_t family;      p.family = v4mapped(prefix) ? AF_INET : AF_INET6;      p.prefixlen = v4mapped(prefix) ? plen - 96 : plen;      if (p.family == AF_INET) {          uchar_to_inaddr(&p.u.prefix4, prefix);          distribute = output ? DISTRIBUTE_V4_OUT : DISTRIBUTE_V4_IN; +        family = AFI_IP;      } else {          uchar_to_in6addr(&p.u.prefix6, prefix);          distribute = output ? DISTRIBUTE_V6_OUT : DISTRIBUTE_V6_IN; +        family = AFI_IP6;      }      if (babel_ifp != NULL && babel_ifp->list[distribute]) { @@ -79,7 +82,7 @@ babel_filter(int output, const unsigned char *prefix, unsigned short plen,          dist = distribute_lookup (babel->distribute_ctx, NULL);      if (dist) {          if (dist->list[distribute]) { -            alist = access_list_lookup (p.family, dist->list[distribute]); +            alist = access_list_lookup (family, dist->list[distribute]);              if (alist) {                  if (access_list_apply (alist, &p) == FILTER_DENY) { @@ -90,7 +93,7 @@ babel_filter(int output, const unsigned char *prefix, unsigned short plen,  	    }  	}          if (dist->prefix[distribute]) { -            plist = prefix_list_lookup (p.family, dist->prefix[distribute]); +            plist = prefix_list_lookup (family, dist->prefix[distribute]);              if (plist) {                  if (prefix_list_apply (plist, &p) == PREFIX_DENY) {                      debugf(BABEL_DEBUG_FILTER,"%pFX filtered by distribute %s", diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c index 62fba1f58e..04005884ae 100644 --- a/bgpd/bgp_ecommunity.c +++ b/bgpd/bgp_ecommunity.c @@ -699,6 +699,7 @@ static struct ecommunity *ecommunity_str2com_internal(const char *str, int type,  	while ((str = ecommunity_gettoken(str, (void *)&eval, &token))) {  		switch (token) {  		case ecommunity_token_rt: +		case ecommunity_token_rt6:  		case ecommunity_token_soo:  			if (!keyword_included || keyword) {  				if (ecom) @@ -746,7 +747,6 @@ static struct ecommunity *ecommunity_str2com_internal(const char *str, int type,  						    ecom->unit_size);  			break;  		case ecommunity_token_unknown: -		default:  			if (ecom)  				ecommunity_free(&ecom);  			return NULL; diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index 3c7fb4cb17..0b5f81ccb0 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -4807,14 +4807,13 @@ DEFUN(show_bgp_l2vpn_evpn_route,  	evpn_show_all_routes(vty, bgp, type, json, detail); -	if (uj) { -		if (detail) { -			vty_out(vty, "%s\n", json_object_to_json_string(json)); -			json_object_free(json); -		} else { -			vty_json(vty, json); -		} -	} +	/* +	 * This is an extremely expensive operation at scale +	 * and as such we need to save as much time as is +	 * possible. +	 */ +	if (uj) +		vty_json_no_pretty(vty, json);  	return CMD_SUCCESS;  } diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c index 49ae9816a3..f9dc64af45 100644 --- a/bgpd/bgp_io.c +++ b/bgpd/bgp_io.c @@ -173,12 +173,11 @@ static int read_ibuf_work(struct peer *peer)  	uint16_t pktsize = 0;  	struct stream *pkt; -	/* Hold the I/O lock, we might not have space on the InQ */ -	frr_mutex_lock_autounlock(&peer->io_mtx);  	/* ============================================== */ - -	if (peer->ibuf->count >= bm->inq_limit) -		return -ENOMEM; +	frr_with_mutex (&peer->io_mtx) { +		if (peer->ibuf->count >= bm->inq_limit) +			return -ENOMEM; +	}  	/* check that we have enough data for a header */  	if (ringbuf_remain(ibw) < BGP_HEADER_SIZE) @@ -211,7 +210,9 @@ static int read_ibuf_work(struct peer *peer)  	stream_set_endp(pkt, pktsize);  	frrtrace(2, frr_bgp, packet_read, peer, pkt); -	stream_fifo_push(peer->ibuf, pkt); +	frr_with_mutex (&peer->io_mtx) { +		stream_fifo_push(peer->ibuf, pkt); +	}  	return pktsize;  } diff --git a/bgpd/bgp_labelpool.c b/bgpd/bgp_labelpool.c index 129878451d..d60552011c 100644 --- a/bgpd/bgp_labelpool.c +++ b/bgpd/bgp_labelpool.c @@ -743,22 +743,12 @@ DEFUN(show_bgp_labelpool_summary, show_bgp_labelpool_summary_cmd,  	if (uj) {  		json = json_object_new_object(); -#if CONFDATE > 20230131 -CPP_NOTICE("Remove JSON object commands with keys starting with capital") -#endif -		json_object_int_add(json, "Ledger", skiplist_count(lp->ledger));  		json_object_int_add(json, "ledger", skiplist_count(lp->ledger)); -		json_object_int_add(json, "InUse", skiplist_count(lp->inuse));  		json_object_int_add(json, "inUse", skiplist_count(lp->inuse)); -		json_object_int_add(json, "Requests", -				    lp_fifo_count(&lp->requests));  		json_object_int_add(json, "requests",  				    lp_fifo_count(&lp->requests)); -		json_object_int_add(json, "LabelChunks", listcount(lp->chunks));  		json_object_int_add(json, "labelChunks", listcount(lp->chunks)); -		json_object_int_add(json, "Pending", lp->pending_count);  		json_object_int_add(json, "pending", lp->pending_count); -		json_object_int_add(json, "Reconnects", lp->reconnect_count);  		json_object_int_add(json, "reconnects", lp->reconnect_count);  		vty_json(vty, json);  	} else { diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 288115f211..33e7d971ad 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -1192,7 +1192,7 @@ leak_update(struct bgp *to_bgp, struct bgp_dest *bn,  			if (!ecommunity_cmp(  				    bgp_attr_get_ecommunity(bpi->attr),  				    bgp_attr_get_ecommunity(new_attr))) { -				vpn_leak_to_vrf_withdraw(to_bgp, bpi); +				vpn_leak_to_vrf_withdraw(bpi);  				bgp_aggregate_decrement(to_bgp, p, bpi, afi,  							safi);  				bgp_path_info_delete(bn, bpi); @@ -1722,7 +1722,7 @@ void vpn_leak_from_vrf_withdraw(struct bgp *to_bgp,		/* to */  	if (bpi) {  		/* withdraw from looped vrfs as well */ -		vpn_leak_to_vrf_withdraw(to_bgp, bpi); +		vpn_leak_to_vrf_withdraw(bpi);  		bgp_aggregate_decrement(to_bgp, p, bpi, afi, safi);  		bgp_path_info_delete(bn, bpi); @@ -1777,7 +1777,7 @@ void vpn_leak_from_vrf_withdraw_all(struct bgp *to_bgp, struct bgp *from_bgp,  						zlog_debug("%s: deleting it",  							   __func__);  					/* withdraw from leak-to vrfs as well */ -					vpn_leak_to_vrf_withdraw(to_bgp, bpi); +					vpn_leak_to_vrf_withdraw(bpi);  					bgp_aggregate_decrement(  						to_bgp, bgp_dest_get_prefix(bn),  						bpi, afi, safi); @@ -1873,7 +1873,10 @@ static bool vpn_leak_to_vrf_update_onevrf(struct bgp *to_bgp,   /* to */  	if (!vpn_leak_from_vpn_active(to_bgp, afi, &debugmsg)) {  		if (debug) -			zlog_debug("%s: skipping: %s", __func__, debugmsg); +			zlog_debug( +				"%s: from vpn (%s) to vrf (%s), skipping: %s", +				__func__, from_bgp->name_pretty, +				to_bgp->name_pretty, debugmsg);  		return false;  	} @@ -2115,8 +2118,7 @@ bool vpn_leak_to_vrf_update(struct bgp *from_bgp,  	return leak_success;  } -void vpn_leak_to_vrf_withdraw(struct bgp *from_bgp,	   /* from */ -			      struct bgp_path_info *path_vpn) /* route */ +void vpn_leak_to_vrf_withdraw(struct bgp_path_info *path_vpn)  {  	const struct prefix *p;  	afi_t afi; @@ -2159,7 +2161,8 @@ void vpn_leak_to_vrf_withdraw(struct bgp *from_bgp,	   /* from */  	for (ALL_LIST_ELEMENTS(bm->bgp, mnode, mnnode, bgp)) {  		if (!vpn_leak_from_vpn_active(bgp, afi, &debugmsg)) {  			if (debug) -				zlog_debug("%s: skipping: %s", __func__, +				zlog_debug("%s: from %s, skipping: %s", +					   __func__, bgp->name_pretty,  					   debugmsg);  			continue;  		} diff --git a/bgpd/bgp_mplsvpn.h b/bgpd/bgp_mplsvpn.h index 7b57e4c75d..b54476e5d3 100644 --- a/bgpd/bgp_mplsvpn.h +++ b/bgpd/bgp_mplsvpn.h @@ -75,8 +75,7 @@ extern bool vpn_leak_to_vrf_update(struct bgp *from_bgp,  				   struct bgp_path_info *path_vpn,  				   struct prefix_rd *prd); -extern void vpn_leak_to_vrf_withdraw(struct bgp *from_bgp, -				     struct bgp_path_info *path_vpn); +extern void vpn_leak_to_vrf_withdraw(struct bgp_path_info *path_vpn);  extern void vpn_leak_zebra_vrf_label_update(struct bgp *bgp, afi_t afi);  extern void vpn_leak_zebra_vrf_label_withdraw(struct bgp *bgp, afi_t afi); diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 9e7c75318e..080cf0ae40 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -2033,7 +2033,8 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)  			break;  		case NLRI_WITHDRAW:  		case NLRI_MP_WITHDRAW: -			nlri_ret = bgp_nlri_parse(peer, &attr, &nlris[i], 1); +			nlri_ret = bgp_nlri_parse(peer, NLRI_ATTR_ARG, +						  &nlris[i], 1);  			break;  		default:  			nlri_ret = BGP_NLRI_PARSE_ERROR; diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index c9cfc44da0..d7ff0e3c0a 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -4456,8 +4456,7 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,  						bgp_evpn_unimport_route(  							bgp, afi, safi, p, pi);  					else /* SAFI_MPLS_VPN */ -						vpn_leak_to_vrf_withdraw(bgp, -									 pi); +						vpn_leak_to_vrf_withdraw(pi);  				}  			}  		} @@ -4877,7 +4876,7 @@ filtered:  		if ((SAFI_MPLS_VPN == safi)  		    && (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) { -			vpn_leak_to_vrf_withdraw(bgp, pi); +			vpn_leak_to_vrf_withdraw(pi);  		}  		bgp_rib_remove(dest, pi, peer, afi, safi); @@ -4979,7 +4978,7 @@ void bgp_withdraw(struct peer *peer, const struct prefix *p,  		if ((SAFI_MPLS_VPN == safi)  		    && (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) { -			vpn_leak_to_vrf_withdraw(bgp, pi); +			vpn_leak_to_vrf_withdraw(pi);  		}  	} else if (bgp_debug_update(peer, p, NULL, 1)) {  		bgp_debug_rdpfxpath2str(afi, safi, prd, p, label, num_labels, @@ -5419,7 +5418,7 @@ static wq_item_status bgp_clear_route_node(struct work_queue *wq, void *data)  			}  			if (SAFI_MPLS_VPN == safi &&  			    bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) { -				vpn_leak_to_vrf_withdraw(bgp, pi); +				vpn_leak_to_vrf_withdraw(pi);  			}  			bgp_rib_remove(dest, pi, peer, afi, safi); @@ -5688,8 +5687,7 @@ void bgp_clear_stale_route(struct peer *peer, afi_t afi, safi_t safi)  						    BGP_ROUTE_IMPORTED &&  					    peer->bgp->inst_type ==  						    BGP_INSTANCE_TYPE_DEFAULT) -						vpn_leak_to_vrf_withdraw( -							peer->bgp, pi); +						vpn_leak_to_vrf_withdraw(pi);  					bgp_rib_remove(rm, pi, peer, afi, safi);  					break; @@ -6384,7 +6382,7 @@ static void bgp_static_withdraw_safi(struct bgp *bgp, const struct prefix *p,  #endif  		if (SAFI_MPLS_VPN == safi  		    && bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) { -			vpn_leak_to_vrf_withdraw(bgp, pi); +			vpn_leak_to_vrf_withdraw(pi);  		}  		bgp_aggregate_decrement(bgp, p, pi, afi, safi);  		bgp_path_info_delete(dest, pi); @@ -9858,8 +9856,6 @@ void route_vty_out_overlay(struct vty *vty, const struct prefix *p,  		if (!json_path) {  			vty_out(vty, "?");  		} else { -			json_object_string_add(json_nexthop, "Error", -					       "Unsupported address-family");  			json_object_string_add(json_nexthop, "error",  					       "Unsupported address-family");  		} @@ -10227,12 +10223,9 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,  				if (tag_buf[0] != '\0')  					vty_out(vty, " VNI %s", tag_buf);  			} else { -				if (tag_buf[0]) { -					json_object_string_add(json_path, "VNI", -							       tag_buf); +				if (tag_buf[0])  					json_object_string_add(json_path, "vni",  							       tag_buf); -				}  			}  		}  	} @@ -11593,7 +11586,16 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,  				else  					vty_out(vty, ",\"%pFX\": ", dest_p);  			} -			vty_json(vty, json_paths); +			/* +			 * We are using no_pretty here because under +			 * extremely high settings( say lots and lots of +			 * routes with lots and lots of ways to reach +			 * that route via different paths ) this can +			 * save several minutes of output when FRR +			 * is run on older cpu's or more underperforming +			 * routers out there +			 */ +			vty_json_no_pretty(vty, json_paths);  			json_paths = NULL;  			first = 0;  		} else diff --git a/bgpd/rfapi/rfapi_vty.h b/bgpd/rfapi/rfapi_vty.h index 09e1b3c4c4..c8b8613feb 100644 --- a/bgpd/rfapi/rfapi_vty.h +++ b/bgpd/rfapi/rfapi_vty.h @@ -62,7 +62,8 @@ extern int rfapiStr2EthAddr(const char *str, struct ethaddr *ea);  extern const char *rfapi_ntop(int af, const void *src, char *buf,  			      socklen_t size); -extern int rfapiDebugPrintf(void *dummy, const char *format, ...); +extern int rfapiDebugPrintf(void *dummy, const char *format, ...) +	PRINTFRR(2, 3);  extern int rfapiStream2Vty(void *stream,			  /* input */  			   int (**fp)(void *, const char *, ...), /* output */ diff --git a/doc/developer/workflow.rst b/doc/developer/workflow.rst index 06a2ccbc0a..f496906101 100644 --- a/doc/developer/workflow.rst +++ b/doc/developer/workflow.rst @@ -342,6 +342,46 @@ summary of the included patches.  The description should provide  additional details that will help the reviewer to understand the context  of the included patches. +Squash commits +-------------- + +Before merging make sure a PR has squashed the following kinds of commits: + +- Fixes/review feedback +- Typos +- Merges and rebases +- Work in progress + +This helps to automatically generate human-readable changelog messages. + +Commit Guidelines +----------------- + +There is a built-in commit linter. Basic rules: + +- Commit messages must be prefixed with the name of the changed subsystem, followed +  by a colon and a space and start with an imperative verb. + +   `Check <https://github.com/FRRouting/frr/tree/master/.github/commitlint.config.js>`_ all +   the supported subsystems. + +- Commit messages must start with a capital letter +- Commit messages must not end with a period ``.`` + +Why was my pull request closed? +------------------------------- + +Pull requests older than 180 days will be closed. Exceptions can be made for +pull requests that have active review comments, or that are awaiting other +dependent pull requests. Closed pull requests are easy to recreate, and little +work is lost by closing a pull request that subsequently needs to be reopened. + +We want to limit the total number of pull requests in flight to: + +- Maintain a clean project +- Remove old pull requests that would be difficult to rebase as the underlying code has changed over time +- Encourage code velocity +  .. _license-for-contributions:  License for Contributions diff --git a/doc/user/installation.rst b/doc/user/installation.rst index 8f89c6c4f8..2310d397cd 100644 --- a/doc/user/installation.rst +++ b/doc/user/installation.rst @@ -314,7 +314,8 @@ options from the list below.     Turn on the ability of FRR to access some shell options( telnet/ssh/bash/etc. )     from vtysh itself.  This option is considered extremely unsecure and should only -   be considered for usage if you really really know what you are doing. +   be considered for usage if you really really know what you are doing.  This +   option is deprecated and will be removed on Feb 1, 2024.  .. option:: --enable-gcov diff --git a/ldpd/ldp_vty_exec.c b/ldpd/ldp_vty_exec.c index c4053f5374..a8cffd6d91 100644 --- a/ldpd/ldp_vty_exec.c +++ b/ldpd/ldp_vty_exec.c @@ -1472,10 +1472,6 @@ show_l2vpn_pw_msg_json(struct imsg *imsg, struct show_params *params,  		json_pw = json_object_new_object();  		json_object_string_addf(json_pw, "peerId", "%pI4", &pw->lsr_id);  		json_object_int_add(json_pw, "vcId", pw->pwid); -#if CONFDATE > 20230131 -CPP_NOTICE("Remove JSON object commands with keys starting with capital") -#endif -		json_object_string_add(json_pw, "VpnName", pw->l2vpn_name);  		json_object_string_add(json_pw, "vpnName", pw->l2vpn_name);  		if (pw->status == PW_FORWARDING)  			json_object_string_add(json_pw, "status", "up"); @@ -36,21 +36,24 @@  #define _FRR_DB_H_  #ifdef HAVE_SQLITE3 +#include "compiler.h"  #include <sqlite3.h>  #ifdef __cplusplus  extern "C" {  #endif -extern int db_init(const char *path_fmt, ...); +extern int db_init(const char *path_fmt, ...) PRINTFRR(1, 2);  extern int db_close(void); +/* WARNING: sqlite format string! not printf compatible! */  extern int db_bindf(struct sqlite3_stmt *ss, const char *fmt, ...);  extern struct sqlite3_stmt *db_prepare_len(const char *stmt, int stmtlen);  extern struct sqlite3_stmt *db_prepare(const char *stmt);  extern int db_run(struct sqlite3_stmt *ss); +/* WARNING: sqlite format string! not scanf compatible! */  extern int db_loadf(struct sqlite3_stmt *ss, const char *fmt, ...);  extern void db_finalize(struct sqlite3_stmt **ss); -extern int db_execute(const char *stmt_fmt, ...); +extern int db_execute(const char *stmt_fmt, ...) PRINTFRR(1, 2);  #ifdef __cplusplus  } diff --git a/lib/libfrr.c b/lib/libfrr.c index aee6981854..2cab6d9824 100644 --- a/lib/libfrr.c +++ b/lib/libfrr.c @@ -789,7 +789,7 @@ struct thread_master *frr_init(void)  #ifdef HAVE_SQLITE3  	if (!di->db_file)  		di->db_file = dbfile_default; -	db_init(di->db_file); +	db_init("%s", di->db_file);  #endif  	if (di->flags & FRR_LIMITED_CLI) @@ -284,7 +284,8 @@ done:  	return len;  } -int vty_json(struct vty *vty, struct json_object *json) +static int vty_json_helper(struct vty *vty, struct json_object *json, +			   uint32_t options)  {  	const char *text; @@ -299,6 +300,18 @@ int vty_json(struct vty *vty, struct json_object *json)  	return CMD_SUCCESS;  } +int vty_json(struct vty *vty, struct json_object *json) +{ +	return vty_json_helper(vty, json, +			       JSON_C_TO_STRING_PRETTY | +				       JSON_C_TO_STRING_NOSLASHESCAPE); +} + +int vty_json_no_pretty(struct vty *vty, struct json_object *json) +{ +	return vty_json_helper(vty, json, JSON_C_TO_STRING_NOSLASHESCAPE); +} +  /* Output current time to the vty. */  void vty_time_print(struct vty *vty, int cr)  { @@ -353,8 +353,12 @@ extern void vty_endframe(struct vty *, const char *);  extern bool vty_set_include(struct vty *vty, const char *regexp);  /* returns CMD_SUCCESS so you can do a one-line "return vty_json(...)"   * NULL check and json_object_free() is included. + * + * _no_pretty means do not add a bunch of newlines and dump the output + * as densely as possible.   */  extern int vty_json(struct vty *vty, struct json_object *json); +extern int vty_json_no_pretty(struct vty *vty, struct json_object *json);  /* post fd to be passed to the vtysh client   * fd is owned by the VTY code after this and will be closed when done diff --git a/lib/zlog.h b/lib/zlog.h index dcc0bf14e9..6316a2ad40 100644 --- a/lib/zlog.h +++ b/lib/zlog.h @@ -71,8 +71,8 @@ struct xrefdata_logmsg {   * determine whether something is a log message or something else.   */ -extern void vzlogx(const struct xref_logmsg *xref, int prio, -		   const char *fmt, va_list ap); +extern void vzlogx(const struct xref_logmsg *xref, int prio, const char *fmt, +		   va_list ap) PRINTFRR(3, 0);  #define vzlog(prio, ...) vzlogx(NULL, prio, __VA_ARGS__)  PRINTFRR(2, 3) diff --git a/ospf6d/ospf6_gr_helper.c b/ospf6d/ospf6_gr_helper.c index 771a710240..661d37e637 100644 --- a/ospf6d/ospf6_gr_helper.c +++ b/ospf6d/ospf6_gr_helper.c @@ -963,22 +963,13 @@ static void show_ospf6_gr_helper_details(struct vty *vty, struct ospf6 *ospf6,  			json, "supportedGracePeriod",  			ospf6->ospf6_helper_cfg.supported_grace_time); -#if CONFDATE > 20230131 -CPP_NOTICE("Remove JSON object commands with keys starting with capital") -#endif  		if (ospf6->ospf6_helper_cfg.last_exit_reason != -		    OSPF6_GR_HELPER_EXIT_NONE) { -			json_object_string_add( -				json, "LastExitReason", -				ospf6_exit_reason_desc -					[ospf6->ospf6_helper_cfg -						 .last_exit_reason]); +		    OSPF6_GR_HELPER_EXIT_NONE)  			json_object_string_add(  				json, "lastExitReason",  				ospf6_exit_reason_desc  					[ospf6->ospf6_helper_cfg  						 .last_exit_reason]); -		}  		if (ospf6->ospf6_helper_cfg.active_restarter_cnt)  			json_object_int_add( @@ -1010,18 +1001,12 @@ CPP_NOTICE("Remove JSON object commands with keys starting with capital")  				if (uj) {  					json_object_object_get_ex( -						json, "Neighbors", -						&json_neighbors); -					json_object_object_get_ex(  						json, "neighbors",  						&json_neighbors);  					if (!json_neighbors) {  						json_neighbors =  						json_object_new_object();  						json_object_object_add( -							json, "Neighbors", -							json_neighbors); -						json_object_object_add(  							json, "neighbors",  							json_neighbors);  					} diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index 55ac7c88a5..cd918d7475 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -83,11 +83,7 @@ static int ospf6_unknown_lsa_show(struct vty *vty, struct ospf6_lsa *lsa,  	start = (uint8_t *)lsa->header + sizeof(struct ospf6_lsa_header);  	end = (uint8_t *)lsa->header + ntohs(lsa->header->length); -#if CONFDATE > 20230131 -CPP_NOTICE("Remove JSON object commands with keys starting with capital") -#endif  	if (use_json) { -		json_object_string_add(json_obj, "LsaType", "unknown");  		json_object_string_add(json_obj, "lsaType", "unknown");  	} else {  		vty_out(vty, "        Unknown contents:\n"); diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index db45fa5f5c..785a48a0a1 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -2015,9 +2015,6 @@ ospf6_show_vrf_name(struct vty *vty, struct ospf6 *ospf6,  	}  } -#if CONFDATE > 20230131 -CPP_NOTICE("Remove JSON object commands with keys containing whitespaces") -#endif  static int  ospf6_show_summary_address(struct vty *vty, struct ospf6 *ospf6,  			json_object *json, @@ -2037,8 +2034,6 @@ ospf6_show_summary_address(struct vty *vty, struct ospf6 *ospf6,  		ospf6_show_vrf_name(vty, ospf6, json_vrf); -		json_object_int_add(json_vrf, "aggregation delay interval", -				    ospf6->aggr_delay_interval);  		json_object_int_add(json_vrf, "aggregationDelayInterval",  				    ospf6->aggr_delay_interval);  	} @@ -2062,18 +2057,10 @@ ospf6_show_summary_address(struct vty *vty, struct ospf6 *ospf6,  						buf,  						json_aggr); -			json_object_string_add(json_aggr, -					"Summary address", -					buf);  			json_object_string_add(json_aggr, "summaryAddress",  					       buf);  			json_object_string_add( -				json_aggr, "Metric-type", -				(aggr->mtype == DEFAULT_METRIC_TYPE) -					? "E2" -					: "E1"); -			json_object_string_add(  				json_aggr, "metricType",  				(aggr->mtype == DEFAULT_METRIC_TYPE) ? "E2"  								     : "E1"); @@ -2086,9 +2073,6 @@ ospf6_show_summary_address(struct vty *vty, struct ospf6 *ospf6,  			json_object_int_add(json_aggr, "Tag",  					    aggr->tag); -			json_object_int_add(json_aggr, -					"External route count", -					OSPF6_EXTERNAL_RT_COUNT(aggr));  			json_object_int_add(json_aggr, "externalRouteCount",  					    OSPF6_EXTERNAL_RT_COUNT(aggr)); diff --git a/ospfd/ospf_ldp_sync.c b/ospfd/ospf_ldp_sync.c index 7b1fa6626f..51cd2a127b 100644 --- a/ospfd/ospf_ldp_sync.c +++ b/ospfd/ospf_ldp_sync.c @@ -507,15 +507,8 @@ void ospf_ldp_sync_show_info(struct vty *vty, struct ospf *ospf,  	if (CHECK_FLAG(ospf->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE)) {  		if (use_json) { -#if CONFDATE > 20230131 -CPP_NOTICE("Remove JSON object commands with keys starting with capital") -#endif -			json_object_boolean_true_add(json_vrf, -						     "MplsLdpIgpSyncEnabled");  			json_object_boolean_true_add(json_vrf,  						     "mplsLdpIgpSyncEnabled"); -			json_object_int_add(json_vrf, "MplsLdpIgpSyncHolddown", -					    ospf->ldp_sync_cmd.holddown);  			json_object_int_add(json_vrf, "mplsLdpIgpSyncHolddown",  					    ospf->ldp_sync_cmd.holddown);  		} else { diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 0b0b9d81ee..469e9955e9 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -10214,17 +10214,10 @@ static int ospf_show_gr_helper_details(struct vty *vty, struct ospf *ospf,  		json_object_int_add(json_vrf, "supportedGracePeriod",  				    ospf->supported_grace_time); -#if CONFDATE > 20230131 -CPP_NOTICE("Remove JSON object commands with keys starting with capital") -#endif -		if (ospf->last_exit_reason != OSPF_GR_HELPER_EXIT_NONE) { -			json_object_string_add( -				json_vrf, "LastExitReason", -				ospf_exit_reason2str(ospf->last_exit_reason)); +		if (ospf->last_exit_reason != OSPF_GR_HELPER_EXIT_NONE)  			json_object_string_add(  				json_vrf, "lastExitReason",  				ospf_exit_reason2str(ospf->last_exit_reason)); -		}  		if (ospf->active_restarter_cnt)  			json_object_int_add(json_vrf, "activeRestarterCnt", @@ -10257,17 +10250,12 @@ CPP_NOTICE("Remove JSON object commands with keys starting with capital")  				continue;  			if (uj) { -				json_object_object_get_ex(json_vrf, "Neighbors", -							  &json_neighbors);  				json_object_object_get_ex(json_vrf, "neighbors",  							  &json_neighbors);  				if (!json_neighbors) {  					json_neighbors =  						json_object_new_object();  					json_object_object_add(json_vrf, -							       "Neighbors", -							       json_neighbors); -					json_object_object_add(json_vrf,  							       "neighbors",  							       json_neighbors);  				} @@ -10563,9 +10551,6 @@ static void config_write_stub_router(struct vty *vty, struct ospf *ospf)  	return;  } -#if CONFDATE > 20230131 -CPP_NOTICE("Remove JSON object commands with keys containing whitespaces") -#endif  static void show_ip_ospf_route_network(struct vty *vty, struct ospf *ospf,  				       struct route_table *rt,  				       json_object *json) @@ -10669,12 +10654,6 @@ static void show_ip_ospf_route_network(struct vty *vty, struct ospf *ospf,  								"ip", " ");  							json_object_string_add(  								json_nexthop, -								"directly attached to", -								ifindex2ifname( -									path->ifindex, -									ospf->vrf_id)); -							json_object_string_add( -								json_nexthop,  								"directlyAttachedTo",  								ifindex2ifname(  									path->ifindex, @@ -10818,12 +10797,6 @@ static void show_ip_ospf_route_router(struct vty *vty, struct ospf *ospf,  								"ip", " ");  							json_object_string_add(  								json_nexthop, -								"directly attached to", -								ifindex2ifname( -									path->ifindex, -									ospf->vrf_id)); -							json_object_string_add( -								json_nexthop,  								"directlyAttachedTo",  								ifindex2ifname(  									path->ifindex, @@ -10950,12 +10923,6 @@ static void show_ip_ospf_route_external(struct vty *vty, struct ospf *ospf,  							" ");  						json_object_string_add(  							json_nexthop, -							"directly attached to", -							ifindex2ifname( -								path->ifindex, -								ospf->vrf_id)); -						json_object_string_add( -							json_nexthop,  							"directlyAttachedTo",  							ifindex2ifname(  								path->ifindex, @@ -11664,8 +11631,6 @@ static int ospf_show_summary_address(struct vty *vty, struct ospf *ospf,  		vty_out(vty, "aggregation delay interval :%u(in seconds)\n\n",  			ospf->aggr_delay_interval);  	} else { -		json_object_int_add(json_vrf, "aggregation delay interval", -				    ospf->aggr_delay_interval);  		json_object_int_add(json_vrf, "aggregationDelayInterval",  				    ospf->aggr_delay_interval);  	} @@ -11684,37 +11649,17 @@ static int ospf_show_summary_address(struct vty *vty, struct ospf *ospf,  				json_object_object_add(json_vrf, buf,  						       json_aggr); - -				json_object_string_add(json_aggr, -						       "Summary address", buf);  				json_object_string_add(json_aggr,  						       "summaryAddress", buf); - -				json_object_string_add( -					json_aggr, "Metric-type", -					(mtype == EXTERNAL_METRIC_TYPE_1) -						? "E1" -						: "E2");  				json_object_string_add(  					json_aggr, "metricType",  					(mtype == EXTERNAL_METRIC_TYPE_1)  						? "E1"  						: "E2"); -#if CONFDATE > 20230131 -CPP_NOTICE("Remove JSON object commands with keys starting with capital") -#endif -				json_object_int_add(json_aggr, "Metric", mval);  				json_object_int_add(json_aggr, "metric", mval); - -				json_object_int_add(json_aggr, "Tag", -						    aggr->tag);  				json_object_int_add(json_aggr, "tag",  						    aggr->tag); - -				json_object_int_add( -					json_aggr, "External route count", -					OSPF_EXTERNAL_RT_COUNT(aggr));  				json_object_int_add(  					json_aggr, "externalRouteCount",  					OSPF_EXTERNAL_RT_COUNT(aggr)); diff --git a/pceplib/pcep_utils_counters.h b/pceplib/pcep_utils_counters.h index 240e9758b7..b10ced7d65 100644 --- a/pceplib/pcep_utils_counters.h +++ b/pceplib/pcep_utils_counters.h @@ -30,6 +30,7 @@  #include <stdbool.h>  #include <stdint.h> +#include <time.h>  #ifdef __cplusplus  extern "C" { diff --git a/pimd/pim_cmd_common.c b/pimd/pim_cmd_common.c index d220ae082f..9b571415fd 100644 --- a/pimd/pim_cmd_common.c +++ b/pimd/pim_cmd_common.c @@ -1140,42 +1140,24 @@ void pim_show_state(struct pim_instance *pim, struct vty *vty,  				json_ifp_in = json_object_new_object();  				json_object_object_add(json_source, in_ifname,  						       json_ifp_in); -				json_object_int_add(json_source, "Installed", -						    c_oil->installed);  				json_object_int_add(json_source, "installed",  						    c_oil->installed);  				json_object_boolean_add(json_source, "isRpt",  							isRpt); -				json_object_int_add(json_source, "RefCount", -						    c_oil->oil_ref_count);  				json_object_int_add(json_source, "refCount",  						    c_oil->oil_ref_count); -				json_object_int_add(json_source, "OilListSize", -						    c_oil->oil_size);  				json_object_int_add(json_source, "oilListSize",  						    c_oil->oil_size);  				json_object_int_add( -					json_source, "OilRescan", -					c_oil->oil_inherited_rescan); -				json_object_int_add(  					json_source, "oilRescan",  					c_oil->oil_inherited_rescan); -				json_object_int_add(json_source, "LastUsed", -						    c_oil->cc.lastused);  				json_object_int_add(json_source, "lastUsed",  						    c_oil->cc.lastused); -				json_object_int_add(json_source, "PacketCount", -						    c_oil->cc.pktcnt);  				json_object_int_add(json_source, "packetCount",  						    c_oil->cc.pktcnt); -				json_object_int_add(json_source, "ByteCount", -						    c_oil->cc.bytecnt);  				json_object_int_add(json_source, "byteCount",  						    c_oil->cc.bytecnt);  				json_object_int_add(json_source, -						    "WrongInterface", -						    c_oil->cc.wrong_if); -				json_object_int_add(json_source,  						    "wrongInterface",  						    c_oil->cc.wrong_if);  			} @@ -1728,14 +1710,8 @@ static void pim_show_join_helper(struct pim_interface *pim_ifp,  		json_object_string_add(  			json_row, "channelJoinName",  			pim_ifchannel_ifjoin_name(ch->ifjoin_state, ch->flags)); -		if (PIM_IF_FLAG_TEST_S_G_RPT(ch->flags)) { -#if CONFDATE > 20230131 -			CPP_NOTICE( -				"Remove JSON object commands with keys starting with capital") -#endif -			json_object_int_add(json_row, "SGRpt", 1); +		if (PIM_IF_FLAG_TEST_S_G_RPT(ch->flags))  			json_object_int_add(json_row, "sgRpt", 1); -		}  		if (PIM_IF_FLAG_TEST_PROTO_PIM(ch->flags))  			json_object_int_add(json_row, "protocolPim", 1);  		if (PIM_IF_FLAG_TEST_PROTO_IGMP(ch->flags)) @@ -3786,8 +3762,6 @@ void show_mroute(struct pim_instance *pim, struct vty *vty, pim_sgaddr *sg,  					    c_oil->oil_ref_count);  			json_object_int_add(json_source, "oilSize",  					    c_oil->oil_size); -			json_object_int_add(json_source, "OilInheritedRescan", -					    c_oil->oil_inherited_rescan);  			json_object_int_add(json_source, "oilInheritedRescan",  					    c_oil->oil_inherited_rescan);  			json_object_string_add(json_source, "iif", in_ifname); diff --git a/tests/bgpd/test_peer_attr.c b/tests/bgpd/test_peer_attr.c index c2e86f2339..cc4f71e688 100644 --- a/tests/bgpd/test_peer_attr.c +++ b/tests/bgpd/test_peer_attr.c @@ -20,6 +20,7 @@  #include "memory.h"  #include "plist.h" +#include "printfrr.h"  #include "bgpd/bgpd.h"  #include "bgpd/bgp_attr.h"  #include "bgpd/bgp_regex.h" @@ -44,8 +45,9 @@  		if ((T)->state != TEST_SUCCESS || (C))                         \  			break;                                                 \  		(T)->state = TEST_ASSERT_ERROR;                                \ -		(T)->error = str_printf("assertion failed: %s (%s:%d)", (#C),  \ -					__FILE__, __LINE__);                   \ +		(T)->error =                                                   \ +			asprintfrr(MTYPE_TMP, "assertion failed: %s (%s:%d)",  \ +				   (#C), __FILE__, __LINE__);                  \  	} while (0)  #define TEST_ASSERT_EQ(T, A, B)                                                \ @@ -53,9 +55,11 @@  		if ((T)->state != TEST_SUCCESS || ((A) == (B)))                \  			break;                                                 \  		(T)->state = TEST_ASSERT_ERROR;                                \ -		(T)->error = str_printf(                                       \ -			"assertion failed: %s[%d] == [%d]%s (%s:%d)", (#A),    \ -			(A), (B), (#B), __FILE__, __LINE__);                   \ +		(T)->error = asprintfrr(                                       \ +			MTYPE_TMP,                                             \ +			"assertion failed: %s[%lld] == [%lld]%s (%s:%d)",      \ +			(#A), (long long)(A), (long long)(B), (#B), __FILE__,  \ +			__LINE__);                                             \  	} while (0)  #define TEST_HANDLER_MAX 5 @@ -212,44 +216,6 @@ static struct test_peer_family test_default_families[] = {  	{.afi = AFI_IP6, .safi = SAFI_MULTICAST},  }; -static char *str_vprintf(const char *fmt, va_list ap) -{ -	int ret; -	int buf_size = 0; -	char *buf = NULL; -	va_list apc; - -	while (1) { -		va_copy(apc, ap); -		ret = vsnprintf(buf, buf_size, fmt, apc); -		va_end(apc); - -		if (ret >= 0 && ret < buf_size) -			break; - -		if (ret >= 0) -			buf_size = ret + 1; -		else -			buf_size *= 2; - -		buf = XREALLOC(MTYPE_TMP, buf, buf_size); -	} - -	return buf; -} - -static char *str_printf(const char *fmt, ...) -{ -	char *buf; -	va_list ap; - -	va_start(ap, fmt); -	buf = str_vprintf(fmt, ap); -	va_end(ap); - -	return buf; -} -  TEST_ATTR_HANDLER_DECL(advertisement_interval, v_routeadv, 10, 20);  TEST_STR_ATTR_HANDLER_DECL(password, password, "FRR-Peer", "FRR-Group");  TEST_ATTR_HANDLER_DECL(local_as, change_local_as, 1, 2); @@ -724,6 +690,7 @@ static bool is_attr_type_global(enum test_peer_attr_type at)  	return at == PEER_AT_GLOBAL_FLAG || at == PEER_AT_GLOBAL_CUSTOM;  } +PRINTFRR(2, 3)  static void test_log(struct test *test, const char *fmt, ...)  {  	va_list ap; @@ -734,10 +701,11 @@ static void test_log(struct test *test, const char *fmt, ...)  	/* Store formatted log message. */  	va_start(ap, fmt); -	listnode_add(test->log, str_vprintf(fmt, ap)); +	listnode_add(test->log, vasprintfrr(MTYPE_TMP, fmt, ap));  	va_end(ap);  } +PRINTFRR(2, 3)  static void test_execute(struct test *test, const char *fmt, ...)  {  	int ret; @@ -751,12 +719,12 @@ static void test_execute(struct test *test, const char *fmt, ...)  	/* Format command string with variadic arguments. */  	va_start(ap, fmt); -	cmd = str_vprintf(fmt, ap); +	cmd = vasprintfrr(MTYPE_TMP, fmt, ap);  	va_end(ap);  	if (!cmd) {  		test->state = TEST_INTERNAL_ERROR; -		test->error = -			str_printf("could not format command string [%s]", fmt); +		test->error = asprintfrr( +			MTYPE_TMP, "could not format command string [%s]", fmt);  		return;  	} @@ -764,7 +732,8 @@ static void test_execute(struct test *test, const char *fmt, ...)  	vline = cmd_make_strvec(cmd);  	if (vline == NULL) {  		test->state = TEST_INTERNAL_ERROR; -		test->error = str_printf( +		test->error = asprintfrr( +			MTYPE_TMP,  			"tokenizing command string [%s] returned empty result",  			cmd);  		XFREE(MTYPE_TMP, cmd); @@ -776,7 +745,8 @@ static void test_execute(struct test *test, const char *fmt, ...)  	ret = cmd_execute_command(vline, test->vty, NULL, 0);  	if (ret != CMD_SUCCESS) {  		test->state = TEST_COMMAND_ERROR; -		test->error = str_printf( +		test->error = asprintfrr( +			MTYPE_TMP,  			"execution of command [%s] has failed with code [%d]",  			cmd, ret);  	} @@ -786,6 +756,7 @@ static void test_execute(struct test *test, const char *fmt, ...)  	XFREE(MTYPE_TMP, cmd);  } +PRINTFRR(2, 0)  static void test_config(struct test *test, const char *fmt, bool invert,  			va_list ap)  { @@ -800,12 +771,12 @@ static void test_config(struct test *test, const char *fmt, bool invert,  	/* Format matcher string with variadic arguments. */  	va_copy(apc, ap); -	matcher = str_vprintf(fmt, apc); +	matcher = vasprintfrr(MTYPE_TMP, fmt, apc);  	va_end(apc);  	if (!matcher) {  		test->state = TEST_INTERNAL_ERROR; -		test->error = -			str_printf("could not format matcher string [%s]", fmt); +		test->error = asprintfrr( +			MTYPE_TMP, "could not format matcher string [%s]", fmt);  		return;  	} @@ -818,11 +789,13 @@ static void test_config(struct test *test, const char *fmt, bool invert,  	matched = !!strstr(config, matcher);  	if (!matched && !invert) {  		test->state = TEST_CONFIG_ERROR; -		test->error = str_printf("expected config [%s] to be present", +		test->error = asprintfrr(MTYPE_TMP, +					 "expected config [%s] to be present",  					 matcher);  	} else if (matched && invert) {  		test->state = TEST_CONFIG_ERROR; -		test->error = str_printf("expected config [%s] to be absent", +		test->error = asprintfrr(MTYPE_TMP, +					 "expected config [%s] to be absent",  					 matcher);  	} @@ -831,6 +804,7 @@ static void test_config(struct test *test, const char *fmt, bool invert,  	XFREE(MTYPE_TMP, config);  } +PRINTFRR(2, 3)  static void test_config_present(struct test *test, const char *fmt, ...)  {  	va_list ap; @@ -840,6 +814,7 @@ static void test_config_present(struct test *test, const char *fmt, ...)  	va_end(ap);  } +PRINTFRR(2, 3)  static void test_config_absent(struct test *test, const char *fmt, ...)  {  	va_list ap; @@ -886,8 +861,8 @@ static void test_initialize(struct test *test)  	test->bgp = bgp_get_default();  	if (!test->bgp) {  		test->state = TEST_INTERNAL_ERROR; -		test->error = -			str_printf("could not retrieve default bgp instance"); +		test->error = asprintfrr( +			MTYPE_TMP, "could not retrieve default bgp instance");  		return;  	} @@ -901,7 +876,8 @@ static void test_initialize(struct test *test)  	}  	if (!test->peer) {  		test->state = TEST_INTERNAL_ERROR; -		test->error = str_printf( +		test->error = asprintfrr( +			MTYPE_TMP,  			"could not retrieve instance of bgp peer [%s]",  			cfg.peer_address);  		return; @@ -911,7 +887,8 @@ static void test_initialize(struct test *test)  	test->group = peer_group_lookup(test->bgp, cfg.peer_group);  	if (!test->group) {  		test->state = TEST_INTERNAL_ERROR; -		test->error = str_printf( +		test->error = asprintfrr( +			MTYPE_TMP,  			"could not retrieve instance of bgp peer-group [%s]",  			cfg.peer_group);  		return; @@ -1081,7 +1058,8 @@ static void test_custom(struct test *test, struct test_peer_attr *pa,  		if (test->state != TEST_SUCCESS) {  			test->state = TEST_CUSTOM_ERROR;  			handler_error = test->error; -			test->error = str_printf("custom handler failed: %s", +			test->error = asprintfrr(MTYPE_TMP, +						 "custom handler failed: %s",  						 handler_error);  			XFREE(MTYPE_TMP, handler_error);  		} @@ -1123,8 +1101,8 @@ static void test_process(struct test *test, struct test_peer_attr *pa,  	default:  		test->state = TEST_INTERNAL_ERROR; -		test->error = -			str_printf("invalid attribute type: %d", pa->type); +		test->error = asprintfrr( +			MTYPE_TMP, "invalid attribute type: %d", pa->type);  		break;  	} @@ -1149,8 +1127,8 @@ static void test_peer_attr(struct test *test, struct test_peer_attr *pa)  	type = str_from_attr_type(pa->type);  	if (!type) {  		test->state = TEST_INTERNAL_ERROR; -		test->error = -			str_printf("invalid attribute type: %d", pa->type); +		test->error = asprintfrr( +			MTYPE_TMP, "invalid attribute type: %d", pa->type);  		return;  	} @@ -1485,11 +1463,11 @@ int main(void)  		/* Build test description string. */  		if (pa->afi && pa->safi) -			desc = str_printf("peer\\%s-%s\\%s", +			desc = asprintfrr(MTYPE_TMP, "peer\\%s-%s\\%s",  					  str_from_afi(pa->afi),  					  str_from_safi(pa->safi), pa->cmd);  		else -			desc = str_printf("peer\\%s", pa->cmd); +			desc = asprintfrr(MTYPE_TMP, "peer\\%s", pa->cmd);  		/* Initialize new test instance. */  		test = test_new(desc, pa->o.use_ibgp, pa->o.use_iface_peer); diff --git a/tests/lib/test_nexthop_iter.c b/tests/lib/test_nexthop_iter.c index f21f3bbb33..a6995d13e8 100644 --- a/tests/lib/test_nexthop_iter.c +++ b/tests/lib/test_nexthop_iter.c @@ -41,6 +41,7 @@ static void str_append(char **buf, const char *repr)  	}  } +PRINTFRR(2, 3)  static void str_appendf(char **buf, const char *format, ...)  {  	va_list ap; diff --git a/tests/topotests/bgp_lu_topo1/R1/labelpool.summ.json b/tests/topotests/bgp_lu_topo1/R1/labelpool.summ.json index e2eee513e6..6db8e002f4 100644 --- a/tests/topotests/bgp_lu_topo1/R1/labelpool.summ.json +++ b/tests/topotests/bgp_lu_topo1/R1/labelpool.summ.json @@ -1,8 +1,8 @@  { -  "Ledger":506, -  "InUse":506, -  "Requests":0, -  "LabelChunks":3, -  "Pending":0, -  "Reconnects":0 +  "ledger":506, +  "inUse":506, +  "requests":0, +  "labelChunks":3, +  "pending":0, +  "reconnects":0  } diff --git a/tests/topotests/bgp_lu_topo1/R2/labelpool.summ.json b/tests/topotests/bgp_lu_topo1/R2/labelpool.summ.json index 9c817e8075..9f9e57511c 100644 --- a/tests/topotests/bgp_lu_topo1/R2/labelpool.summ.json +++ b/tests/topotests/bgp_lu_topo1/R2/labelpool.summ.json @@ -1,8 +1,8 @@  { -  "Ledger":0, -  "InUse":0, -  "Requests":0, -  "LabelChunks":0, -  "Pending":0, -  "Reconnects":0 +  "ledger":0, +  "inUse":0, +  "requests":0, +  "labelChunks":0, +  "pending":0, +  "reconnects":0  } diff --git a/tests/topotests/bgp_lu_topo2/R1/labelpool.summ.json b/tests/topotests/bgp_lu_topo2/R1/labelpool.summ.json index 0dc59b58cf..59ecd27f7f 100644 --- a/tests/topotests/bgp_lu_topo2/R1/labelpool.summ.json +++ b/tests/topotests/bgp_lu_topo2/R1/labelpool.summ.json @@ -1,8 +1,8 @@  { -  "Ledger":51, -  "InUse":51, -  "Requests":0, -  "LabelChunks":1, -  "Pending":0, -  "Reconnects":0 +  "ledger":51, +  "inUse":51, +  "requests":0, +  "labelChunks":1, +  "pending":0, +  "reconnects":0  } diff --git a/tests/topotests/bgp_lu_topo2/R2/labelpool.summ.json b/tests/topotests/bgp_lu_topo2/R2/labelpool.summ.json index eb1ae93b6c..2c52192cd6 100644 --- a/tests/topotests/bgp_lu_topo2/R2/labelpool.summ.json +++ b/tests/topotests/bgp_lu_topo2/R2/labelpool.summ.json @@ -1,8 +1,8 @@  { -  "Ledger":1, -  "InUse":1, -  "Requests":0, -  "LabelChunks":1, -  "Pending":0, -  "Reconnects":0 +  "ledger":1, +  "inUse":1, +  "requests":0, +  "labelChunks":1, +  "pending":0, +  "reconnects":0  } diff --git a/tests/topotests/bgp_route_map_vpn_import/__init__.py b/tests/topotests/bgp_route_map_vpn_import/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/bgp_route_map_vpn_import/__init__.py diff --git a/tests/topotests/bgp_route_map_vpn_import/r1/bgpd.conf b/tests/topotests/bgp_route_map_vpn_import/r1/bgpd.conf new file mode 100644 index 0000000000..c9ad0b1a5b --- /dev/null +++ b/tests/topotests/bgp_route_map_vpn_import/r1/bgpd.conf @@ -0,0 +1,46 @@ +! +debug bgp updates +debug bgp vpn leak-from-vrf +debug bgp vpn leak-to-vrf +debug bgp nht +debug route-map +! +router bgp 65001 + bgp router-id 10.10.10.10 + no bgp ebgp-requires-policy +! +router bgp 65001 vrf Customer + bgp router-id 192.168.1.2 + no bgp ebgp-requires-policy + address-family ipv4 unicast +  redistribute connected +  rd vpn export 192.168.1.2:2 +  rt vpn import 192.168.1.2:2 +  rt vpn export 192.168.1.2:2 +  export vpn +  import vpn + exit-address-family +! +router bgp 65001 vrf Service + bgp router-id 192.168.2.2 + no bgp ebgp-requires-policy + address-family ipv4 unicast +  redistribute connected +  rd vpn export 192.168.2.2:2 +  rt vpn import 192.168.2.2:2 192.168.1.2:2 +  rt vpn export 192.168.2.2:2 +  route-map vpn import from-customer +  export vpn +  import vpn + exit-address-family +! +bgp extcommunity-list standard from-customer seq 5 permit rt 192.168.1.2:2 +! +ip prefix-list p1 seq 5 permit 192.0.2.0/24 +! +route-map from-customer permit 10 + match extcommunity from-customer + match ip address prefix-list p1 + set local-preference 123 +route-map from-customer permit 20 +! diff --git a/tests/topotests/bgp_route_map_vpn_import/r1/zebra.conf b/tests/topotests/bgp_route_map_vpn_import/r1/zebra.conf new file mode 100644 index 0000000000..51966b2636 --- /dev/null +++ b/tests/topotests/bgp_route_map_vpn_import/r1/zebra.conf @@ -0,0 +1,16 @@ +! +interface lo + ip address 10.10.10.10/32 +! +interface r1-eth0 vrf Customer + ip address 192.168.1.2/24 +! +interface r1-eth1 vrf Service + ip address 192.168.2.2/24 +! +interface r1-eth2 + ip address 10.0.1.1/24 +! +interface r1-eth3 vrf Customer + ip address 192.0.2.1/24 +! diff --git a/tests/topotests/bgp_route_map_vpn_import/test_bgp_route_map_vpn_import.py b/tests/topotests/bgp_route_map_vpn_import/test_bgp_route_map_vpn_import.py new file mode 100644 index 0000000000..9de1b1a0e3 --- /dev/null +++ b/tests/topotests/bgp_route_map_vpn_import/test_bgp_route_map_vpn_import.py @@ -0,0 +1,126 @@ +#!/usr/bin/env python + +# +# Copyright (c) 2022 by +# Donatas Abraitis <donatas@opensourcerouting.org> +# +# Permission to use, copy, modify, and/or distribute this software +# for any purpose with or without fee is hereby granted, provided +# that the above copyright notice and this permission notice appear +# in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY +# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. +# + +""" +Test if `route-map vpn import NAME` works by setting/matching via route-maps. +Routes from VRF Customer to VRF Service MUST be leaked and modified later +with `route-map vpn import`. +""" + +import os +import sys +import json +import pytest +import functools + +CWD = os.path.dirname(os.path.realpath(__file__)) +sys.path.append(os.path.join(CWD, "../")) + +# pylint: disable=C0413 +from lib import topotest +from lib.topogen import Topogen, TopoRouter, get_topogen +from lib.common_config import step + +pytestmark = [pytest.mark.bgpd] + + +def build_topo(tgen): +    tgen.add_router("r1") + +    switch = tgen.add_switch("s1") +    switch.add_link(tgen.gears["r1"]) + +    switch = tgen.add_switch("s2") +    switch.add_link(tgen.gears["r1"]) + +    switch = tgen.add_switch("s3") +    switch.add_link(tgen.gears["r1"]) + +    switch = tgen.add_switch("s4") +    switch.add_link(tgen.gears["r1"]) + + +def setup_module(mod): +    tgen = Topogen(build_topo, mod.__name__) +    tgen.start_topology() + +    r1 = tgen.gears["r1"] + +    r1.run("ip link add Customer type vrf table 1001") +    r1.run("ip link set up dev Customer") +    r1.run("ip link set r1-eth0 master Customer") +    r1.run("ip link add Service type vrf table 1002") +    r1.run("ip link set up dev Service") +    r1.run("ip link set r1-eth1 master Service") +    r1.run("ip link set r1-eth3 master Customer") + +    router_list = tgen.routers() + +    for i, (rname, router) in enumerate(router_list.items(), 1): +        router.load_config( +            TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname)) +        ) +        router.load_config( +            TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname)) +        ) + +    tgen.start_router() + + +def teardown_module(mod): +    tgen = get_topogen() +    tgen.stop_topology() + + +def test_bgp_route_map_vpn_import(): +    tgen = get_topogen() + +    if tgen.routers_have_failure(): +        pytest.skip(tgen.errors) + +    r1 = tgen.gears["r1"] + +    def _bgp_check_received_leaked_with_vpn_import(): +        output = json.loads(r1.vtysh_cmd("show bgp vrf Service ipv4 unicast json")) +        expected = { +            "routes": { +                "192.0.2.0/24": [ +                    { +                        "locPrf": 123, +                    }, +                ], +                "192.168.1.0/24": [ +                    { +                        "locPrf": None, +                    } +                ], +            } +        } +        return topotest.json_cmp(output, expected) + +    test_func = functools.partial(_bgp_check_received_leaked_with_vpn_import) +    _, result = topotest.run_and_expect(test_func, None, count=60, wait=1) +    assert result is None, "Failed, imported routes are not modified" + + +if __name__ == "__main__": +    args = ["-s"] + sys.argv[1:] +    sys.exit(pytest.main(args)) diff --git a/tests/topotests/ldp_snmp/r1/show_l2vpn_vc.ref b/tests/topotests/ldp_snmp/r1/show_l2vpn_vc.ref index 29e9df1089..675af4d788 100644 --- a/tests/topotests/ldp_snmp/r1/show_l2vpn_vc.ref +++ b/tests/topotests/ldp_snmp/r1/show_l2vpn_vc.ref @@ -2,7 +2,7 @@    "r1-mpw0":{      "peerId":"2.2.2.2",      "vcId":100, -    "VpnName":"CUST_A", +    "vpnName":"CUST_A",      "status":"up"    }  } diff --git a/tests/topotests/ldp_snmp/r2/show_l2vpn_vc.ref b/tests/topotests/ldp_snmp/r2/show_l2vpn_vc.ref index 942ed23a1e..045a8cfb9c 100644 --- a/tests/topotests/ldp_snmp/r2/show_l2vpn_vc.ref +++ b/tests/topotests/ldp_snmp/r2/show_l2vpn_vc.ref @@ -2,7 +2,7 @@    "r2-mpw0":{      "peerId":"1.1.1.1",      "vcId":100, -    "VpnName":"CUST_A", +    "vpnName":"CUST_A",      "status":"up"    }  } diff --git a/tests/topotests/ldp_sync_isis_topo1/r1/show_l2vpn_vc.ref b/tests/topotests/ldp_sync_isis_topo1/r1/show_l2vpn_vc.ref index 29e9df1089..675af4d788 100644 --- a/tests/topotests/ldp_sync_isis_topo1/r1/show_l2vpn_vc.ref +++ b/tests/topotests/ldp_sync_isis_topo1/r1/show_l2vpn_vc.ref @@ -2,7 +2,7 @@    "r1-mpw0":{      "peerId":"2.2.2.2",      "vcId":100, -    "VpnName":"CUST_A", +    "vpnName":"CUST_A",      "status":"up"    }  } diff --git a/tests/topotests/ldp_sync_isis_topo1/r2/show_l2vpn_vc.ref b/tests/topotests/ldp_sync_isis_topo1/r2/show_l2vpn_vc.ref index 942ed23a1e..045a8cfb9c 100644 --- a/tests/topotests/ldp_sync_isis_topo1/r2/show_l2vpn_vc.ref +++ b/tests/topotests/ldp_sync_isis_topo1/r2/show_l2vpn_vc.ref @@ -2,7 +2,7 @@    "r2-mpw0":{      "peerId":"1.1.1.1",      "vcId":100, -    "VpnName":"CUST_A", +    "vpnName":"CUST_A",      "status":"up"    }  } diff --git a/tests/topotests/ldp_sync_ospf_topo1/r1/show_l2vpn_vc.ref b/tests/topotests/ldp_sync_ospf_topo1/r1/show_l2vpn_vc.ref index 29e9df1089..675af4d788 100644 --- a/tests/topotests/ldp_sync_ospf_topo1/r1/show_l2vpn_vc.ref +++ b/tests/topotests/ldp_sync_ospf_topo1/r1/show_l2vpn_vc.ref @@ -2,7 +2,7 @@    "r1-mpw0":{      "peerId":"2.2.2.2",      "vcId":100, -    "VpnName":"CUST_A", +    "vpnName":"CUST_A",      "status":"up"    }  } diff --git a/tests/topotests/ldp_sync_ospf_topo1/r2/show_l2vpn_vc.ref b/tests/topotests/ldp_sync_ospf_topo1/r2/show_l2vpn_vc.ref index 942ed23a1e..045a8cfb9c 100644 --- a/tests/topotests/ldp_sync_ospf_topo1/r2/show_l2vpn_vc.ref +++ b/tests/topotests/ldp_sync_ospf_topo1/r2/show_l2vpn_vc.ref @@ -2,7 +2,7 @@    "r2-mpw0":{      "peerId":"1.1.1.1",      "vcId":100, -    "VpnName":"CUST_A", +    "vpnName":"CUST_A",      "status":"up"    }  } diff --git a/tests/topotests/ldp_vpls_topo1/r1/show_l2vpn_vc.ref b/tests/topotests/ldp_vpls_topo1/r1/show_l2vpn_vc.ref index 29e9df1089..675af4d788 100644 --- a/tests/topotests/ldp_vpls_topo1/r1/show_l2vpn_vc.ref +++ b/tests/topotests/ldp_vpls_topo1/r1/show_l2vpn_vc.ref @@ -2,7 +2,7 @@    "r1-mpw0":{      "peerId":"2.2.2.2",      "vcId":100, -    "VpnName":"CUST_A", +    "vpnName":"CUST_A",      "status":"up"    }  } diff --git a/tests/topotests/ldp_vpls_topo1/r2/show_l2vpn_vc.ref b/tests/topotests/ldp_vpls_topo1/r2/show_l2vpn_vc.ref index 942ed23a1e..045a8cfb9c 100644 --- a/tests/topotests/ldp_vpls_topo1/r2/show_l2vpn_vc.ref +++ b/tests/topotests/ldp_vpls_topo1/r2/show_l2vpn_vc.ref @@ -2,7 +2,7 @@    "r2-mpw0":{      "peerId":"1.1.1.1",      "vcId":100, -    "VpnName":"CUST_A", +    "vpnName":"CUST_A",      "status":"up"    }  } diff --git a/tests/topotests/lib/bgp.py b/tests/topotests/lib/bgp.py index 2be0f5773b..aa7b4a2174 100644 --- a/tests/topotests/lib/bgp.py +++ b/tests/topotests/lib/bgp.py @@ -4277,7 +4277,7 @@ def verify_attributes_for_evpn_routes(                          for _rd, route_data in evpn_rd_value_json.items():                              if route_data["ip"] == route:                                  for rt_data in route_data["paths"]: -                                    if vni_dict[vrf] == rt_data["VNI"]: +                                    if vni_dict[vrf] == rt_data["vni"]:                                          rt_string = rt_data["extendedCommunity"][                                              "string"                                          ] diff --git a/tests/topotests/lib/ospf.py b/tests/topotests/lib/ospf.py index e7ea7d32ba..59ae1a2559 100644 --- a/tests/topotests/lib/ospf.py +++ b/tests/topotests/lib/ospf.py @@ -1533,11 +1533,11 @@ def verify_ospf_summary(tgen, topo, dut, input_dict, ospf=None, expected=True):      -----      input_dict = {          "11.0.0.0/8": { -            "Summary address": "11.0.0.0/8", -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 5 +            "summaryAddress": "11.0.0.0/8", +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 5          }      }      result = verify_ospf_summary(tgen, topo, dut, input_dict) @@ -1586,7 +1586,7 @@ def verify_ospf_summary(tgen, topo, dut, input_dict, ospf=None, expected=True):      for ospf_summ, summ_data in ospf_summary_data.items():          if ospf_summ not in show_ospf_json:              continue -        summary = ospf_summary_data[ospf_summ]["Summary address"] +        summary = ospf_summary_data[ospf_summ]["summaryAddress"]          if summary in show_ospf_json:              for summ in summ_data: diff --git a/tests/topotests/lib/pim.py b/tests/topotests/lib/pim.py index 32dda82712..0af1ecf6a0 100644 --- a/tests/topotests/lib/pim.py +++ b/tests/topotests/lib/pim.py @@ -1827,12 +1827,12 @@ def verify_pim_state(          else:              pim_state_json = show_pim_state_json[grp_addr][src_address] -        if pim_state_json["Installed"] == installed_fl: +        if pim_state_json["installed"] == installed_fl:              logger.info(                  "[DUT %s]: group  %s is installed flag: %s",                  dut,                  grp_addr, -                pim_state_json["Installed"], +                pim_state_json["installed"],              )              for interface, data in pim_state_json[iif].items():                  if interface != oil: diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_topo1.py b/tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_topo1.py index 5b163d28e4..af21290dd6 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_topo1.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_topo1.py @@ -308,11 +308,11 @@ def test_ospf_type5_summary_tc43_p0(request):      step("Verify that show ip ospf summary should show the summaries.")      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -336,11 +336,11 @@ def test_ospf_type5_summary_tc43_p0(request):      input_dict = {          "11.0.0.0/16": { -            "Summary address": "11.0.0.0/16", -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 5, +            "summaryAddress": "11.0.0.0/16", +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -380,11 +380,11 @@ def test_ospf_type5_summary_tc43_p0(request):      input_dict = {          "11.0.0.0/16": { -            "Summary address": "11.0.0.0/24", -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 0, +            "summaryAddress": "11.0.0.0/24", +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 0,          }      }      dut = "r0" @@ -556,11 +556,11 @@ def test_ospf_type5_summary_tc48_p0(request):      step("Verify that show ip ospf summary should show the summaries.")      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -652,11 +652,11 @@ def test_ospf_type5_summary_tc48_p0(request):      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -749,11 +749,11 @@ def test_ospf_type5_summary_tc42_p0(request):      step("Verify that show ip ospf summary should show the summaries.")      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -820,11 +820,11 @@ def test_ospf_type5_summary_tc42_p0(request):      step("show ip ospf summary should not have any summary address.")      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -859,11 +859,11 @@ def test_ospf_type5_summary_tc42_p0(request):      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -942,11 +942,11 @@ def test_ospf_type5_summary_tc42_p0(request):      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -1078,11 +1078,11 @@ def test_ospf_type5_summary_tc42_p0(request):      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -1242,11 +1242,11 @@ def test_ospf_type5_summary_tc45_p0(request):      step("Verify that show ip ospf summary should show the summaries with tag.")      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 1234, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 1234, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -1294,11 +1294,11 @@ def test_ospf_type5_summary_tc45_p0(request):      step("show ip ospf summary should not have any summary address.")      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 1234, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 1234, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -1335,11 +1335,11 @@ def test_ospf_type5_summary_tc45_p0(request):      step("Verify that show ip ospf summary should show the summaries with tag.")      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 1, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 1, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -1384,11 +1384,11 @@ def test_ospf_type5_summary_tc45_p0(request):      )      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 4294967295, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 4294967295, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -1441,11 +1441,11 @@ def test_ospf_type5_summary_tc45_p0(request):      )      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 88888, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 88888, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -1673,11 +1673,11 @@ def test_ospf_type5_summary_tc45_p0(request):      step("Verify that show ip ospf summary should show the summaries with tag.")      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 1234, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 1234, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -1722,11 +1722,11 @@ def test_ospf_type5_summary_tc45_p0(request):      step("show ip ospf summary should not have any summary address.")      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 1234, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 1234, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -1763,11 +1763,11 @@ def test_ospf_type5_summary_tc45_p0(request):      step("Verify that show ip ospf summary should show the summaries with tag.")      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 1, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 1, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -1812,11 +1812,11 @@ def test_ospf_type5_summary_tc45_p0(request):      )      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 4294967295, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 4294967295, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -1869,11 +1869,11 @@ def test_ospf_type5_summary_tc45_p0(request):      )      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 88888, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 88888, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -2060,8 +2060,8 @@ def test_ospf_type5_summary_tc46_p0(request):      step("Verify that show ip ospf summary should show the " "configured summaries.")      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -2111,11 +2111,11 @@ def test_ospf_type5_summary_tc46_p0(request):      step("show ip ospf summary should not have any summary address.")      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 1234, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 1234, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -2167,8 +2167,8 @@ def test_ospf_type5_summary_tc46_p0(request):      step("Verify that show ip ospf summary should show the " "configured summaries.")      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -2229,11 +2229,11 @@ def test_ospf_type5_summary_tc46_p0(request):      step("Verify that show ip ospf summary should show the summaries.")      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -2343,11 +2343,11 @@ def test_ospf_type5_summary_tc47_p0(request):      step("Verify that show ip ospf summary should show the summaries.")      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -2440,11 +2440,11 @@ def test_ospf_type5_summary_tc47_p0(request):      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -2528,11 +2528,11 @@ def test_ospf_type5_summary_tc47_p0(request):      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -2623,11 +2623,11 @@ def test_ospf_type5_summary_tc47_p0(request):      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -2791,11 +2791,11 @@ def test_ospf_type5_summary_tc47_p0(request):      step("Verify that show ip ospf summary should show the summaries.")      input_dict = {          "12.0.0.0/8": { -            "Summary address": "12.0.0.0/8", -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 5, +            "summaryAddress": "12.0.0.0/8", +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -2997,11 +2997,11 @@ def test_ospf_type5_summary_tc51_p2(request):      input_dict = {          SUMMARY["ipv4"][2]: { -            "Summary address": SUMMARY["ipv4"][2], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 0, +            "summaryAddress": SUMMARY["ipv4"][2], +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 0,          }      }      dut = "r0" @@ -3092,11 +3092,11 @@ def test_ospf_type5_summary_tc49_p2(request):      step("Verify that show ip ospf summary should show the summaries.")      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -3148,11 +3148,11 @@ def test_ospf_type5_summary_tc49_p2(request):      step("Verify that show ip ospf summary should show the summaries.")      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -3212,11 +3212,11 @@ def test_ospf_type5_summary_tc49_p2(request):      step("Verify that show ip ospf summary should show the summaries.")      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -3269,11 +3269,11 @@ def test_ospf_type5_summary_tc49_p2(request):      step("Verify that show ip ospf summary should show the summaries.")      input_dict = {          SUMMARY["ipv4"][0]: { -            "Summary address": SUMMARY["ipv4"][0], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][0], +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 5,          }      }      dut = "r0" diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_type7_lsa.py b/tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_type7_lsa.py index b890f9a8aa..9886339796 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_type7_lsa.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_type7_lsa.py @@ -290,11 +290,11 @@ def test_ospf_type5_summary_tc44_p0(request):      step("Verify that show ip ospf summary should show the summaries.")      input_dict = {          SUMMARY["ipv4"][3]: { -            "Summary address": SUMMARY["ipv4"][3], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][3], +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -342,11 +342,11 @@ def test_ospf_type5_summary_tc44_p0(request):      step("Verify that type7 LSAs received from neighbor are not summarised.")      input_dict = {          "13.0.0.0/8": { -            "Summary address": "13.0.0.0/8", -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 0, +            "summaryAddress": "13.0.0.0/8", +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 0,          }      }      dut = "r0" @@ -358,11 +358,11 @@ def test_ospf_type5_summary_tc44_p0(request):      step("Verify that already originated summary is intact.")      input_dict = {          SUMMARY["ipv4"][3]: { -            "Summary address": SUMMARY["ipv4"][3], -            "Metric-type": "E2", -            "Metric": 20, -            "Tag": 0, -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv4"][3], +            "metricType": "E2", +            "metric": 20, +            "tag": 0, +            "externalRouteCount": 5,          }      }      dut = "r0" diff --git a/tests/topotests/ospf_gr_topo1/rt1/show_ip_ospf_route.json b/tests/topotests/ospf_gr_topo1/rt1/show_ip_ospf_route.json index 548ca1e2d1..dc19e03b30 100644 --- a/tests/topotests/ospf_gr_topo1/rt1/show_ip_ospf_route.json +++ b/tests/topotests/ospf_gr_topo1/rt1/show_ip_ospf_route.json @@ -6,7 +6,7 @@      "nexthops":[        {          "ip":" ", -        "directly attached to":"lo" +        "directlyAttachedTo":"lo"        }      ]    }, @@ -83,7 +83,7 @@      "nexthops":[        {          "ip":" ", -        "directly attached to":"eth-rt2" +        "directlyAttachedTo":"eth-rt2"        }      ]    }, diff --git a/tests/topotests/ospf_gr_topo1/rt2/show_ip_ospf_route.json b/tests/topotests/ospf_gr_topo1/rt2/show_ip_ospf_route.json index 4accb2ba4a..3e2aba81e8 100644 --- a/tests/topotests/ospf_gr_topo1/rt2/show_ip_ospf_route.json +++ b/tests/topotests/ospf_gr_topo1/rt2/show_ip_ospf_route.json @@ -17,7 +17,7 @@      "nexthops":[        {          "ip":" ", -        "directly attached to":"lo" +        "directlyAttachedTo":"lo"        }      ]    }, @@ -83,7 +83,7 @@      "nexthops":[        {          "ip":" ", -        "directly attached to":"eth-rt1" +        "directlyAttachedTo":"eth-rt1"        }      ]    }, @@ -94,7 +94,7 @@      "nexthops":[        {          "ip":" ", -        "directly attached to":"eth-rt3" +        "directlyAttachedTo":"eth-rt3"        }      ]    }, diff --git a/tests/topotests/ospf_gr_topo1/rt3/show_ip_ospf_route.json b/tests/topotests/ospf_gr_topo1/rt3/show_ip_ospf_route.json index b2f37e25a1..c17cf65c8a 100644 --- a/tests/topotests/ospf_gr_topo1/rt3/show_ip_ospf_route.json +++ b/tests/topotests/ospf_gr_topo1/rt3/show_ip_ospf_route.json @@ -28,7 +28,7 @@      "nexthops":[        {          "ip":" ", -        "directly attached to":"lo" +        "directlyAttachedTo":"lo"        }      ]    }, @@ -94,7 +94,7 @@      "nexthops":[        {          "ip":" ", -        "directly attached to":"eth-rt2" +        "directlyAttachedTo":"eth-rt2"        }      ]    }, @@ -105,7 +105,7 @@      "nexthops":[        {          "ip":" ", -        "directly attached to":"eth-rt4" +        "directlyAttachedTo":"eth-rt4"        }      ]    }, @@ -116,7 +116,7 @@      "nexthops":[        {          "ip":" ", -        "directly attached to":"eth-rt6" +        "directlyAttachedTo":"eth-rt6"        }      ]    }, diff --git a/tests/topotests/ospf_gr_topo1/rt4/show_ip_ospf_route.json b/tests/topotests/ospf_gr_topo1/rt4/show_ip_ospf_route.json index 04e318aef0..74de027860 100644 --- a/tests/topotests/ospf_gr_topo1/rt4/show_ip_ospf_route.json +++ b/tests/topotests/ospf_gr_topo1/rt4/show_ip_ospf_route.json @@ -39,7 +39,7 @@      "nexthops":[        {          "ip":" ", -        "directly attached to":"lo" +        "directlyAttachedTo":"lo"        }      ]    }, @@ -105,7 +105,7 @@      "nexthops":[        {          "ip":" ", -        "directly attached to":"eth-rt3" +        "directlyAttachedTo":"eth-rt3"        }      ]    }, @@ -127,7 +127,7 @@      "nexthops":[        {          "ip":" ", -        "directly attached to":"eth-rt5" +        "directlyAttachedTo":"eth-rt5"        }      ]    }, diff --git a/tests/topotests/ospf_gr_topo1/rt5/show_ip_ospf_route.json b/tests/topotests/ospf_gr_topo1/rt5/show_ip_ospf_route.json index e7f712ea6b..5ecc222a94 100644 --- a/tests/topotests/ospf_gr_topo1/rt5/show_ip_ospf_route.json +++ b/tests/topotests/ospf_gr_topo1/rt5/show_ip_ospf_route.json @@ -50,7 +50,7 @@      "nexthops":[        {          "ip":" ", -        "directly attached to":"lo" +        "directlyAttachedTo":"lo"        }      ]    }, @@ -127,7 +127,7 @@      "nexthops":[        {          "ip":" ", -        "directly attached to":"eth-rt4" +        "directlyAttachedTo":"eth-rt4"        }      ]    }, diff --git a/tests/topotests/ospf_gr_topo1/rt6/show_ip_ospf_route.json b/tests/topotests/ospf_gr_topo1/rt6/show_ip_ospf_route.json index d9009724d5..50de685aec 100644 --- a/tests/topotests/ospf_gr_topo1/rt6/show_ip_ospf_route.json +++ b/tests/topotests/ospf_gr_topo1/rt6/show_ip_ospf_route.json @@ -61,7 +61,7 @@      "nexthops":[        {          "ip":" ", -        "directly attached to":"lo" +        "directlyAttachedTo":"lo"        }      ]    }, @@ -116,7 +116,7 @@      "nexthops":[        {          "ip":" ", -        "directly attached to":"eth-rt3" +        "directlyAttachedTo":"eth-rt3"        }      ]    }, @@ -138,7 +138,7 @@      "nexthops":[        {          "ip":" ", -        "directly attached to":"eth-rt7" +        "directlyAttachedTo":"eth-rt7"        }      ]    }, diff --git a/tests/topotests/ospf_gr_topo1/rt7/show_ip_ospf_route.json b/tests/topotests/ospf_gr_topo1/rt7/show_ip_ospf_route.json index 89bad320bb..b8177d1cdc 100644 --- a/tests/topotests/ospf_gr_topo1/rt7/show_ip_ospf_route.json +++ b/tests/topotests/ospf_gr_topo1/rt7/show_ip_ospf_route.json @@ -83,7 +83,7 @@      "nexthops":[        {          "ip":" ", -        "directly attached to":"lo" +        "directlyAttachedTo":"lo"        }      ]    }, @@ -149,7 +149,7 @@      "nexthops":[        {          "ip":" ", -        "directly attached to":"eth-rt6" +        "directlyAttachedTo":"eth-rt6"        }      ]    }, diff --git a/tests/topotests/ospf_unnumbered/r1/ospf-route.json b/tests/topotests/ospf_unnumbered/r1/ospf-route.json index 6beb7e9bed..cfd9d85e61 100644 --- a/tests/topotests/ospf_unnumbered/r1/ospf-route.json +++ b/tests/topotests/ospf_unnumbered/r1/ospf-route.json @@ -1 +1 @@ -{ "10.0.1.1\/32": { "routeType": "N", "cost": 10, "area": "0.0.0.0", "nexthops": [ { "ip": " ", "directly attached to": "r1-eth0" } ] }, "10.0.20.1\/32": { "routeType": "N", "cost": 20, "area": "0.0.0.0", "nexthops": [ { "ip": "10.0.3.2", "via": "r1-eth1" } ] }, "10.0.255.2": { "routeType": "R ", "cost": 10, "area": "0.0.0.0", "routerType": "asbr", "nexthops": [ { "ip": "10.0.3.2", "via": "r1-eth1" } ] } } +{ "10.0.1.1\/32": { "routeType": "N", "cost": 10, "area": "0.0.0.0", "nexthops": [ { "ip": " ", "directlyAttachedTo": "r1-eth0" } ] }, "10.0.20.1\/32": { "routeType": "N", "cost": 20, "area": "0.0.0.0", "nexthops": [ { "ip": "10.0.3.2", "via": "r1-eth1" } ] }, "10.0.255.2": { "routeType": "R ", "cost": 10, "area": "0.0.0.0", "routerType": "asbr", "nexthops": [ { "ip": "10.0.3.2", "via": "r1-eth1" } ] } } diff --git a/tests/topotests/ospf_unnumbered/r2/ospf-route.json b/tests/topotests/ospf_unnumbered/r2/ospf-route.json index 3cfd255bfd..e56b872411 100644 --- a/tests/topotests/ospf_unnumbered/r2/ospf-route.json +++ b/tests/topotests/ospf_unnumbered/r2/ospf-route.json @@ -1 +1 @@ -{ "10.0.1.1\/32": { "routeType": "N", "cost": 20, "area": "0.0.0.0", "nexthops": [ { "ip": "10.0.3.4", "via": "r2-eth1" } ] }, "10.0.20.1\/32": { "routeType": "N", "cost": 10, "area": "0.0.0.0", "nexthops": [ { "ip": " ", "directly attached to": "r2-eth0" } ] }, "10.0.255.1": { "routeType": "R ", "cost": 10, "area": "0.0.0.0", "routerType": "asbr", "nexthops": [ { "ip": "10.0.3.4", "via": "r2-eth1" } ] } } +{ "10.0.1.1\/32": { "routeType": "N", "cost": 20, "area": "0.0.0.0", "nexthops": [ { "ip": "10.0.3.4", "via": "r2-eth1" } ] }, "10.0.20.1\/32": { "routeType": "N", "cost": 10, "area": "0.0.0.0", "nexthops": [ { "ip": " ", "directlyAttachedTo": "r2-eth0" } ] }, "10.0.255.1": { "routeType": "R ", "cost": 10, "area": "0.0.0.0", "routerType": "asbr", "nexthops": [ { "ip": "10.0.3.4", "via": "r2-eth1" } ] } } diff --git a/tests/topotests/ospfv3_basic_functionality/test_ospfv3_asbr_summary_topo1.py b/tests/topotests/ospfv3_basic_functionality/test_ospfv3_asbr_summary_topo1.py index 1a92c597be..b8fbbb3f63 100644 --- a/tests/topotests/ospfv3_basic_functionality/test_ospfv3_asbr_summary_topo1.py +++ b/tests/topotests/ospfv3_basic_functionality/test_ospfv3_asbr_summary_topo1.py @@ -332,11 +332,11 @@ def test_ospfv3_type5_summary_tc42_p0(request):      step("Verify that show ip ospf summary should show the summaries.")      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][0], +            "metricType": "E2",              "Metric": 20,              "Tag": 0, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -403,11 +403,11 @@ def test_ospfv3_type5_summary_tc42_p0(request):      step("show ip ospf summary should not have any summary address.")      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][0], +            "metricType": "E2",              "Metric": 20,              "Tag": 0, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -444,11 +444,11 @@ def test_ospfv3_type5_summary_tc42_p0(request):      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][0], +            "metricType": "E2",              "Metric": 20,              "Tag": 0, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -527,11 +527,11 @@ def test_ospfv3_type5_summary_tc42_p0(request):      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][0], +            "metricType": "E2",              "Metric": 20,              "Tag": 0, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -665,11 +665,11 @@ def test_ospfv3_type5_summary_tc42_p0(request):      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][0], +            "metricType": "E2",              "Metric": 20,              "Tag": 0, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -822,11 +822,11 @@ def test_ospfv3_type5_summary_tc43_p0(request):      step("Verify that show ip ospf summary should show the summaries.")      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][0], +            "metricType": "E2",              "Metric": 20,              "Tag": 0, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -857,11 +857,11 @@ def test_ospfv3_type5_summary_tc43_p0(request):      input_dict = {          "2011::/16": { -            "Summary address": "2011::/16", -            "Metric-type": "E2", +            "summaryAddress": "2011::/16", +            "metricType": "E2",              "Metric": 20,              "Tag": 0, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -901,11 +901,11 @@ def test_ospfv3_type5_summary_tc43_p0(request):      input_dict = {          "2011::/32": { -            "Summary address": "2011::/32", -            "Metric-type": "E2", +            "summaryAddress": "2011::/32", +            "metricType": "E2",              "Metric": 20,              "Tag": 0, -            "External route count": 0, +            "externalRouteCount": 0,          }      }      dut = "r0" @@ -1084,11 +1084,11 @@ def ospfv3_type5_summary_tc45_p0(request):      step("Verify that show ip ospf summary should show the summaries with tag.")      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][0], +            "metricType": "E2",              "Metric": 20,              "Tag": 1234, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -1136,11 +1136,11 @@ def ospfv3_type5_summary_tc45_p0(request):      step("show ip ospf summary should not have any summary address.")      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][0], +            "metricType": "E2",              "Metric": 20,              "Tag": 1234, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -1179,11 +1179,11 @@ def ospfv3_type5_summary_tc45_p0(request):      step("Verify that show ip ospf summary should show the summaries with tag.")      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][0], +            "metricType": "E2",              "Metric": 20,              "Tag": 1, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -1228,11 +1228,11 @@ def ospfv3_type5_summary_tc45_p0(request):      )      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][0], +            "metricType": "E2",              "Metric": 20,              "Tag": 4294967295, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -1287,11 +1287,11 @@ def ospfv3_type5_summary_tc45_p0(request):      )      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][0], +            "metricType": "E2",              "Metric": 20,              "Tag": 88888, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -1521,11 +1521,11 @@ def ospfv3_type5_summary_tc45_p0(request):      step("Verify that show ip ospf summary should show the summaries with tag.")      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][0], +            "metricType": "E2",              "Metric": 20,              "Tag": 1234, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -1570,11 +1570,11 @@ def ospfv3_type5_summary_tc45_p0(request):      step("show ip ospf summary should not have any summary address.")      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][0], +            "metricType": "E2",              "Metric": 20,              "Tag": 1234, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -1613,11 +1613,11 @@ def ospfv3_type5_summary_tc45_p0(request):      step("Verify that show ip ospf summary should show the summaries with tag.")      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][0], +            "metricType": "E2",              "Metric": 20,              "Tag": 1, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -1662,11 +1662,11 @@ def ospfv3_type5_summary_tc45_p0(request):      )      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][0], +            "metricType": "E2",              "Metric": 20,              "Tag": 4294967295, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -1721,11 +1721,11 @@ def ospfv3_type5_summary_tc45_p0(request):      )      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][0], +            "metricType": "E2",              "Metric": 20,              "Tag": 88888, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -1914,8 +1914,8 @@ def test_ospfv3_type5_summary_tc46_p0(request):      step("Verify that show ip ospf summary should show the " "configured summaries.")      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv6"][0], +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -1965,11 +1965,11 @@ def test_ospfv3_type5_summary_tc46_p0(request):      step("show ip ospf summary should not have any summary address.")      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][0], +            "metricType": "E2",              "Metric": 20,              "Tag": 1234, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -2023,8 +2023,8 @@ def test_ospfv3_type5_summary_tc46_p0(request):      step("Verify that show ip ospf summary should show the " "configured summaries.")      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "External route count": 5, +            "summaryAddress": SUMMARY["ipv6"][0], +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -2085,11 +2085,11 @@ def test_ospfv3_type5_summary_tc46_p0(request):      step("Verify that show ip ospf summary should show the summaries.")      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][0], +            "metricType": "E2",              "Metric": 20,              "Tag": 0, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -2207,11 +2207,11 @@ def test_ospfv3_type5_summary_tc48_p0(request):      step("Verify that show ip ospf summary should show the summaries.")      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][0], +            "metricType": "E2",              "Metric": 20,              "Tag": 0, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -2304,11 +2304,11 @@ def test_ospfv3_type5_summary_tc48_p0(request):      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][0], +            "metricType": "E2",              "Metric": 20,              "Tag": 0, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -2341,11 +2341,11 @@ def test_ospfv3_type5_summary_tc48_p0(request):      )      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][0], +            "metricType": "E2",              "Metric": 20,              "Tag": 0, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -2378,11 +2378,11 @@ def test_ospfv3_type5_summary_tc48_p0(request):      )      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][0], +            "metricType": "E2",              "Metric": 20,              "Tag": 0, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -2558,11 +2558,11 @@ def test_ospfv3_type5_summary_tc51_p2(request):      input_dict = {          SUMMARY["ipv6"][3]: { -            "Summary address": SUMMARY["ipv6"][3], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][3], +            "metricType": "E2",              "Metric": 20,              "Tag": 0, -            "External route count": 0, +            "externalRouteCount": 0,          }      }      dut = "r0" @@ -2653,11 +2653,11 @@ def test_ospfv3_type5_summary_tc49_p2(request):      step("Verify that show ip ospf summary should show the summaries.")      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][0], +            "metricType": "E2",              "Metric": 20,              "Tag": 0, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" @@ -2709,11 +2709,11 @@ def test_ospfv3_type5_summary_tc49_p2(request):      step("Verify that show ip ospf summary should show the summaries.")      input_dict = {          SUMMARY["ipv6"][0]: { -            "Summary address": SUMMARY["ipv6"][0], -            "Metric-type": "E2", +            "summaryAddress": SUMMARY["ipv6"][0], +            "metricType": "E2",              "Metric": 20,              "Tag": 0, -            "External route count": 5, +            "externalRouteCount": 5,          }      }      dut = "r0" diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 7885188483..acc984ced7 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -4014,6 +4014,9 @@ DEFUN (vtysh_traceroute6,  	return CMD_SUCCESS;  } +#if CONFDATE > 20240201 +CPP_NOTICE("Remove HAVE_SHELL_ACCESS and it's documentation"); +#endif  #if defined(HAVE_SHELL_ACCESS)  DEFUN (vtysh_telnet,         vtysh_telnet_cmd, diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 7e86d15b4b..c6ff5089ca 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -5554,6 +5554,7 @@ void zebra_vxlan_advertise_svi_macip(ZAPI_HANDLER_ARGS)  		struct zebra_if *zif = NULL;  		struct zebra_l2info_vxlan zl2_info;  		struct interface *vlan_if = NULL; +		int old_advertise;  		zevpn = zebra_evpn_lookup(vni);  		if (!zevpn) @@ -5561,19 +5562,20 @@ void zebra_vxlan_advertise_svi_macip(ZAPI_HANDLER_ARGS)  		if (IS_ZEBRA_DEBUG_VXLAN)  			zlog_debug( -				"EVPN SVI macip Adv %s on VNI %d , currently %s", +				"EVPN SVI macip Adv %s on VNI %d, currently %s",  				advertise ? "enabled" : "disabled", vni,  				advertise_svi_macip_enabled(zevpn)  					? "enabled"  					: "disabled"); -		if (zevpn->advertise_svi_macip == advertise) -			return; +		old_advertise = advertise_svi_macip_enabled(zevpn);  		/* Store flag even though SVI is not present.  		 * Once SVI comes up triggers self MAC-IP route add.  		 */  		zevpn->advertise_svi_macip = advertise; +		if (advertise_svi_macip_enabled(zevpn) == old_advertise) +			return;  		ifp = zevpn->vxlan_if;  		if (!ifp) @@ -5637,7 +5639,7 @@ void zebra_vxlan_advertise_subnet(ZAPI_HANDLER_ARGS)  		return;  	if (IS_ZEBRA_DEBUG_VXLAN) -		zlog_debug("EVPN subnet Adv %s on VNI %d , currently %s", +		zlog_debug("EVPN subnet Adv %s on VNI %d, currently %s",  			   advertise ? "enabled" : "disabled", vni,  			   zevpn->advertise_subnet ? "enabled" : "disabled"); @@ -5719,6 +5721,7 @@ void zebra_vxlan_advertise_gw_macip(ZAPI_HANDLER_ARGS)  		struct zebra_l2info_vxlan zl2_info;  		struct interface *vlan_if = NULL;  		struct interface *vrr_if = NULL; +		int old_advertise;  		zevpn = zebra_evpn_lookup(vni);  		if (!zevpn) @@ -5726,15 +5729,16 @@ void zebra_vxlan_advertise_gw_macip(ZAPI_HANDLER_ARGS)  		if (IS_ZEBRA_DEBUG_VXLAN)  			zlog_debug( -				"EVPN gateway macip Adv %s on VNI %d , currently %s", +				"EVPN gateway macip Adv %s on VNI %d, currently %s",  				advertise ? "enabled" : "disabled", vni,  				advertise_gw_macip_enabled(zevpn) ? "enabled" -								 : "disabled"); +								  : "disabled"); -		if (zevpn->advertise_gw_macip == advertise) -			return; +		old_advertise = advertise_gw_macip_enabled(zevpn);  		zevpn->advertise_gw_macip = advertise; +		if (advertise_gw_macip_enabled(zevpn) == old_advertise) +			return;  		ifp = zevpn->vxlan_if;  		if (!ifp)  | 
