summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_mpath.c115
-rw-r--r--bgpd/bgp_packet.c1
-rw-r--r--bgpd/bgp_route.c9
-rw-r--r--bgpd/bgpd.c6
-rw-r--r--doc/user/isisd.rst2
-rw-r--r--doc/user/ldpd.rst2
-rw-r--r--doc/user/nhrpd.rst6
-rw-r--r--isisd/isis_events.c5
-rw-r--r--isisd/isis_spf.c2
-rw-r--r--lib/bfd.c6
-rw-r--r--lib/bfd.h2
-rw-r--r--lib/zclient.c1
-rw-r--r--nhrpd/nhrp_interface.c2
-rw-r--r--nhrpd/nhrp_nhs.c4
-rw-r--r--nhrpd/nhrp_packet.c27
-rw-r--r--nhrpd/nhrp_peer.c105
-rw-r--r--nhrpd/nhrp_shortcut.c4
-rw-r--r--nhrpd/nhrp_vty.c62
-rw-r--r--nhrpd/nhrpd.h10
-rw-r--r--nhrpd/subdir.am4
-rw-r--r--ospfd/ospf_vty.c198
-rw-r--r--tests/topotests/bfd_topo3/test_bfd_topo3.py2
-rw-r--r--tests/topotests/bfd_vrf_topo1/test_bfd_vrf_topo1.py2
-rw-r--r--tests/topotests/bgp_accept_own/test_bgp_accept_own.py2
-rw-r--r--tests/topotests/bgp_addpath_best_selected/test_bgp_addpath_best_selected.py2
-rw-r--r--tests/topotests/bgp_aggregate_address_matching_med/test_bgp_aggregate_address_matching_med.py2
-rw-r--r--tests/topotests/bgp_aggregate_address_origin/test_bgp_aggregate-address_origin.py6
-rw-r--r--tests/topotests/bgp_aggregate_address_route_map/test_bgp_aggregate-address_route-map.py2
-rw-r--r--tests/topotests/bgp_aggregator_zero/test_bgp_aggregator_zero.py4
-rw-r--r--tests/topotests/bgp_aigp/test_bgp_aigp.py2
-rw-r--r--tests/topotests/bgp_as_override/test_bgp_as_override.py2
-rw-r--r--tests/topotests/bgp_as_wide_bgp_identifier/test_bgp_as_wide_bgp_identifier.py6
-rw-r--r--tests/topotests/bgp_asdot_regex/test_bgp_asdot_regex.py4
-rw-r--r--tests/topotests/bgp_aspath_zero/test_bgp_aspath_zero.py4
-rw-r--r--tests/topotests/bgp_auth/test_bgp_auth1.py2
-rw-r--r--tests/topotests/bgp_auth/test_bgp_auth2.py2
-rw-r--r--tests/topotests/bgp_auth/test_bgp_auth3.py2
-rw-r--r--tests/topotests/bgp_auth/test_bgp_auth4.py2
-rw-r--r--tests/topotests/bgp_bfd_down_cease_notification/r1/bfdd.conf4
-rw-r--r--tests/topotests/bgp_bfd_down_cease_notification/r1/bgpd.conf2
-rw-r--r--tests/topotests/bgp_bfd_down_cease_notification/test_bgp_bfd_down_cease_notification.py5
-rw-r--r--tests/topotests/bgp_bfd_down_cease_notification/test_bgp_bfd_down_cease_notification_shutdown.py122
-rw-r--r--tests/topotests/bgp_blackhole_community/test_bgp_blackhole_community.py10
-rw-r--r--tests/topotests/bgp_comm_list_delete/test_bgp_comm-list_delete.py2
-rw-r--r--tests/topotests/bgp_comm_list_match/test_bgp_comm_list_match.py2
-rw-r--r--tests/topotests/bgp_community_alias/test_bgp-community-alias.py8
-rw-r--r--tests/topotests/bgp_community_change_update/test_bgp_community_change_update.py8
-rw-r--r--tests/topotests/bgp_conditional_advertisement/test_bgp_conditional_advertisement.py58
-rw-r--r--tests/topotests/bgp_conditional_advertisement_track_peer/test_bgp_conditional_advertisement_track_peer.py2
-rw-r--r--tests/topotests/bgp_confederation_astype/test_bgp_confederation_astype.py2
-rw-r--r--tests/topotests/bgp_default_afi_safi/test_bgp-default-afi-safi.py2
-rw-r--r--tests/topotests/bgp_default_originate_timer/test_bgp_default_originate_timer.py2
-rw-r--r--tests/topotests/bgp_default_originate_withdraw/test_bgp_default_originate_withdraw.py2
-rw-r--r--tests/topotests/bgp_default_route/test_bgp_default-originate.py10
-rw-r--r--tests/topotests/bgp_default_route_route_map_match/test_bgp_default-originate_route-map_match.py6
-rw-r--r--tests/topotests/bgp_default_route_route_map_match2/test_bgp_default-originate_route-map_match2.py10
-rw-r--r--tests/topotests/bgp_default_route_route_map_match_set/test_bgp_default-originate_route-map_match_set.py6
-rw-r--r--tests/topotests/bgp_default_route_route_map_set/test_bgp_default-originate_route-map_set.py2
-rw-r--r--tests/topotests/bgp_disable_addpath_rx/test_disable_addpath_rx.py6
-rw-r--r--tests/topotests/bgp_distance_change/test_bgp_distance_change.py6
-rw-r--r--tests/topotests/bgp_dont_capability_negotiate/test_bgp_dont_capability_negotiate.py2
-rw-r--r--tests/topotests/bgp_duplicate_nexthop/r1/bgpd.conf13
-rw-r--r--tests/topotests/bgp_duplicate_nexthop/r1/isisd.conf26
-rw-r--r--tests/topotests/bgp_duplicate_nexthop/r1/zebra.conf24
-rw-r--r--tests/topotests/bgp_duplicate_nexthop/r3/bgpd.conf16
-rw-r--r--tests/topotests/bgp_duplicate_nexthop/r3/isisd.conf38
-rw-r--r--tests/topotests/bgp_duplicate_nexthop/r3/zebra.conf16
-rw-r--r--tests/topotests/bgp_duplicate_nexthop/r4/isisd.conf30
-rw-r--r--tests/topotests/bgp_duplicate_nexthop/r4/zebra.conf20
-rw-r--r--tests/topotests/bgp_duplicate_nexthop/r5/bgpd.conf19
-rw-r--r--tests/topotests/bgp_duplicate_nexthop/r5/isisd.conf26
-rw-r--r--tests/topotests/bgp_duplicate_nexthop/r5/zebra.conf19
-rw-r--r--tests/topotests/bgp_duplicate_nexthop/r6/bgpd.conf19
-rw-r--r--tests/topotests/bgp_duplicate_nexthop/r6/isisd.conf22
-rw-r--r--tests/topotests/bgp_duplicate_nexthop/r6/zebra.conf20
-rw-r--r--tests/topotests/bgp_duplicate_nexthop/test_bgp_duplicate_nexthop.py458
-rw-r--r--tests/topotests/bgp_ebgp_common_subnet_nexthop_unchanged/test_bgp-ebgp-common-subnet-nexthop-unchanged.py6
-rw-r--r--tests/topotests/bgp_ebgp_requires_policy/test_bgp_ebgp_requires_policy.py14
-rw-r--r--tests/topotests/bgp_extcomm_list_delete/test_bgp_extcomm-list_delete.py2
-rw-r--r--tests/topotests/bgp_extended_optional_parameters_length/test_bgp_extended_optional_parameters_length.py2
-rw-r--r--tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py2
-rw-r--r--tests/topotests/bgp_gshut/test_bgp_gshut.py2
-rw-r--r--tests/topotests/bgp_ipv4_class_e_peer/test_bgp_ipv4_class_e_peer.py2
-rw-r--r--tests/topotests/bgp_ipv6_ll_peering/test_bgp_ipv6_ll_peering.py2
-rw-r--r--tests/topotests/bgp_l3vpn_label_export/test_bgp_l3vpn_label_export.py2
-rw-r--r--tests/topotests/bgp_labeled_unicast_addpath/test_bgp_labeled_unicast_addpath.py2
-rw-r--r--tests/topotests/bgp_labeled_unicast_default_originate/test_bgp_labeled_unicast_default_originate.py2
-rw-r--r--tests/topotests/bgp_large_comm_list_match/test_bgp_large_comm_list_match.py2
-rw-r--r--tests/topotests/bgp_llgr/test_bgp_llgr.py2
-rw-r--r--tests/topotests/bgp_local_as/test_bgp_local_as.py2
-rw-r--r--tests/topotests/bgp_local_as_dotplus_private_remove/test_bgp_local_as_dotplus_private_remove.py2
-rw-r--r--tests/topotests/bgp_local_as_private_remove/test_bgp_local_as_private_remove.py2
-rw-r--r--tests/topotests/bgp_lu_explicitnull/test_bgp_lu_explicitnull.py6
-rw-r--r--tests/topotests/bgp_max_med_on_startup/test_bgp_max_med_on_startup.py8
-rw-r--r--tests/topotests/bgp_maximum_prefix_invalid_update/test_bgp_maximum_prefix_invalid_update.py2
-rw-r--r--tests/topotests/bgp_maximum_prefix_out/test_bgp_maximum_prefix_out.py4
-rwxr-xr-xtests/topotests/bgp_minimum_holdtime/test_bgp_minimum_holdtime.py4
-rw-r--r--tests/topotests/bgp_node_target_extcommunities/test_bgp_node_target_extcommunities.py2
-rw-r--r--tests/topotests/bgp_orf/test_bgp_orf.py2
-rw-r--r--tests/topotests/bgp_path_selection/test_bgp_path_selection.py2
-rw-r--r--tests/topotests/bgp_peer_graceful_shutdown/test_bgp_peer_graceful_shutdown.py2
-rw-r--r--tests/topotests/bgp_peer_group/test_bgp_peer-group.py2
-rw-r--r--tests/topotests/bgp_prefix_list_any/test_bgp_prefix_list_any.py2
-rw-r--r--tests/topotests/bgp_prefix_sid/test_bgp_prefix_sid.py8
-rw-r--r--tests/topotests/bgp_reject_as_sets/test_bgp_reject_as_sets.py8
-rw-r--r--tests/topotests/bgp_remove_private_as/test_bgp_remove_private_as.py2
-rw-r--r--tests/topotests/bgp_remove_private_as_route_map/test_bgp_remove_private_as_route_map.py2
-rw-r--r--tests/topotests/bgp_rmap_extcommunity_none/test_bgp_rmap_extcommunity_none.py6
-rw-r--r--tests/topotests/bgp_roles_capability/test_bgp_roles_capability.py10
-rw-r--r--tests/topotests/bgp_roles_filtering/test_bgp_roles_filtering.py2
-rw-r--r--tests/topotests/bgp_route_map_delay_timer/test_bgp_route_map_delay_timer.py2
-rw-r--r--tests/topotests/bgp_route_map_match_ipv6_nexthop/test_bgp_route_map_match_ipv6_nexthop.py4
-rw-r--r--tests/topotests/bgp_route_map_match_source_protocol/test_bgp_route_map_match_source_protocol.py2
-rw-r--r--tests/topotests/bgp_route_map_on_match_next/test_bgp_route_map_on_match_next.py8
-rw-r--r--tests/topotests/bgp_route_map_vpn_import/test_bgp_route_map_vpn_import.py2
-rw-r--r--tests/topotests/bgp_route_server_client/test_bgp_route_server_client.py2
-rw-r--r--tests/topotests/bgp_rpki_topo1/test_bgp_rpki_topo1.py2
-rw-r--r--tests/topotests/bgp_sender_as_path_loop_detection/test_bgp_sender-as-path-loop-detection.py2
-rw-r--r--tests/topotests/bgp_set_aspath_exclude/test_bgp_set_aspath_exclude.py2
-rw-r--r--tests/topotests/bgp_set_aspath_replace/test_bgp_set_aspath_replace.py2
-rw-r--r--tests/topotests/bgp_set_local_preference_add_subtract/test_bgp_set_local-preference_add_subtract.py6
-rw-r--r--tests/topotests/bgp_software_version/test_bgp_software_version.py2
-rw-r--r--tests/topotests/bgp_soo/test_bgp_soo.py2
-rwxr-xr-xtests/topotests/bgp_srv6l3vpn_sid/test_bgp_srv6l3vpn_sid.py4
-rwxr-xr-xtests/topotests/bgp_srv6l3vpn_to_bgp_vrf/test_bgp_srv6l3vpn_to_bgp_vrf.py2
-rwxr-xr-xtests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/test_bgp_srv6l3vpn_to_bgp_vrf2.py2
-rw-r--r--tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/test_bgp_srv6l3vpn_to_bgp_vrf3.py2
-rw-r--r--tests/topotests/bgp_suppress_fib/test_bgp_suppress_fib.py2
-rw-r--r--tests/topotests/bgp_tcp_mss/test_bgp_tcp_mss.py10
-rw-r--r--tests/topotests/bgp_tcp_mss_passive/test_bgp_tcp_mss_passive.py2
-rw-r--r--tests/topotests/bgp_unnumbered/test_bgp_unnumbered.py6
-rw-r--r--tests/topotests/bgp_update_delay/test_bgp_update_delay.py20
-rw-r--r--tests/topotests/bgp_vpn_5549_route_map/test_bgp_vpn_5549_route_map.py2
-rw-r--r--tests/topotests/bgp_vpnv4_asbr/test_bgp_vpnv4_asbr.py28
-rw-r--r--tests/topotests/bgp_vpnv4_ebgp/test_bgp_vpnv4_ebgp.py14
-rw-r--r--tests/topotests/bgp_vpnv4_per_nexthop_label/test_bgp_vpnv4_per_nexthop_label.py24
-rw-r--r--tests/topotests/bgp_vpnv6_per_nexthop_label/test_bgp_vpnv6_per_nexthop_label.py22
-rw-r--r--tests/topotests/bgp_weighted_ecmp_recursive/__init__.py0
-rw-r--r--tests/topotests/bgp_weighted_ecmp_recursive/r1/frr.conf16
-rw-r--r--tests/topotests/bgp_weighted_ecmp_recursive/r2/frr.conf20
-rw-r--r--tests/topotests/bgp_weighted_ecmp_recursive/r3/frr.conf20
-rw-r--r--tests/topotests/bgp_weighted_ecmp_recursive/r4/frr.conf17
-rw-r--r--tests/topotests/bgp_weighted_ecmp_recursive/r5/frr.conf17
-rw-r--r--tests/topotests/bgp_weighted_ecmp_recursive/test_bgp_weighted_ecmp_recursive.py109
-rw-r--r--tests/topotests/lib/common_check.py48
-rw-r--r--tests/topotests/lib/topotest.py24
-rw-r--r--tests/topotests/nhrp_topo/r1/nhrpd.conf3
-rw-r--r--tests/topotests/nhrp_topo/r2/nhrpd.conf3
-rw-r--r--tests/topotests/nhrp_topo/test_nhrp_topo.py67
-rw-r--r--tests/topotests/ospf_p2mp/test_ospf_p2mp_broadcast.py27
-rw-r--r--tests/topotests/ospf_p2mp/test_ospf_p2mp_non_broadcast.py16
-rw-r--r--yang/frr-isisd.yang4
-rw-r--r--zebra/dplane_fpm_nl.c40
-rw-r--r--zebra/zebra_dplane.c5
-rw-r--r--zebra/zebra_dplane.h2
-rw-r--r--zebra/zebra_nhg.c6
156 files changed, 1827 insertions, 583 deletions
diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c
index e12d84b84c..eadd52b8e0 100644
--- a/bgpd/bgp_mpath.c
+++ b/bgpd/bgp_mpath.c
@@ -605,31 +605,43 @@ void bgp_path_info_mpath_update(struct bgp *bgp, struct bgp_dest *dest,
if (mp_node && (listgetdata(mp_node) == cur_mpath)) {
list_delete_node(mp_list, mp_node);
bgp_path_info_mpath_dequeue(cur_mpath);
- if ((mpath_count < maxpaths)
- && prev_mpath
- && bgp_path_info_nexthop_cmp(prev_mpath,
- cur_mpath)) {
+ if ((mpath_count < maxpaths) && prev_mpath) {
+ mpath_count++;
+ if (bgp_path_info_nexthop_cmp(prev_mpath,
+ cur_mpath)) {
+ if (ecommunity_linkbw_present(
+ bgp_attr_get_ecommunity(
+ cur_mpath->attr),
+ &bwval) ||
+ ecommunity_linkbw_present(
+ bgp_attr_get_ipv6_ecommunity(
+ cur_mpath->attr),
+ &bwval))
+ cum_bw += bwval;
+ else
+ all_paths_lb = false;
+ if (debug) {
+ bgp_path_info_path_with_addpath_rx_str(
+ cur_mpath, path_buf,
+ sizeof(path_buf));
+ zlog_debug("%pBD: %s is still multipath, cur count %d",
+ dest, path_buf,
+ mpath_count);
+ }
+ } else {
+ if (debug) {
+ bgp_path_info_path_with_addpath_rx_str(
+ cur_mpath, path_buf,
+ sizeof(path_buf));
+ zlog_debug("%pBD: nexthop equal, however add mpath %s nexthop %pI4, cur count %d",
+ dest, path_buf,
+ &cur_mpath->attr->nexthop,
+ mpath_count);
+ }
+ }
bgp_path_info_mpath_enqueue(prev_mpath,
cur_mpath);
prev_mpath = cur_mpath;
- mpath_count++;
- if (ecommunity_linkbw_present(bgp_attr_get_ecommunity(
- cur_mpath->attr),
- &bwval) ||
- ecommunity_linkbw_present(
- bgp_attr_get_ipv6_ecommunity(
- cur_mpath->attr),
- &bwval))
- cum_bw += bwval;
- else
- all_paths_lb = false;
- if (debug) {
- bgp_path_info_path_with_addpath_rx_str(
- cur_mpath, path_buf,
- sizeof(path_buf));
- zlog_debug("%pBD: %s is still multipath, cur count %d",
- dest, path_buf, mpath_count);
- }
} else {
mpath_changed = 1;
if (debug) {
@@ -693,35 +705,50 @@ void bgp_path_info_mpath_update(struct bgp *bgp, struct bgp_dest *dest,
list_delete_node(mp_list, mp_node);
assert(new_mpath);
assert(prev_mpath);
- if ((mpath_count < maxpaths) && (new_mpath != new_best)
- && bgp_path_info_nexthop_cmp(prev_mpath,
- new_mpath)) {
+ if ((mpath_count < maxpaths) && (new_mpath != new_best)) {
+ /* keep duplicate nexthop */
bgp_path_info_mpath_dequeue(new_mpath);
bgp_path_info_mpath_enqueue(prev_mpath,
new_mpath);
- prev_mpath = new_mpath;
mpath_changed = 1;
mpath_count++;
- if (ecommunity_linkbw_present(bgp_attr_get_ecommunity(
- new_mpath->attr),
- &bwval) ||
- ecommunity_linkbw_present(
- bgp_attr_get_ipv6_ecommunity(
- new_mpath->attr),
- &bwval))
- cum_bw += bwval;
- else
- all_paths_lb = false;
- if (debug) {
- bgp_path_info_path_with_addpath_rx_str(
- new_mpath, path_buf,
- sizeof(path_buf));
- zlog_debug("%pBD: add mpath %s nexthop %pI4, cur count %d",
- dest, path_buf,
- &new_mpath->attr->nexthop,
- mpath_count);
+ if (bgp_path_info_nexthop_cmp(prev_mpath,
+ new_mpath)) {
+ if (ecommunity_linkbw_present(
+ bgp_attr_get_ecommunity(
+ new_mpath->attr),
+ &bwval) ||
+ ecommunity_linkbw_present(
+ bgp_attr_get_ipv6_ecommunity(
+ new_mpath->attr),
+ &bwval))
+ cum_bw += bwval;
+ else
+ all_paths_lb = false;
+ if (debug) {
+ bgp_path_info_path_with_addpath_rx_str(
+ new_mpath, path_buf,
+ sizeof(path_buf));
+ zlog_debug("%pBD: add mpath %s nexthop %pI4, cur count %d",
+ dest, path_buf,
+ &new_mpath->attr
+ ->nexthop,
+ mpath_count);
+ }
+ } else {
+ if (debug) {
+ bgp_path_info_path_with_addpath_rx_str(
+ new_mpath, path_buf,
+ sizeof(path_buf));
+ zlog_debug("%pBD: nexthop equal, however add mpath %s nexthop %pI4, cur count %d",
+ dest, path_buf,
+ &new_mpath->attr
+ ->nexthop,
+ mpath_count);
+ }
}
+ prev_mpath = new_mpath;
}
mp_node = mp_next_node;
}
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 3f38790cbd..8a4453f124 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -982,6 +982,7 @@ static void bgp_notify_send_internal(struct peer_connection *connection,
peer->notify.code = bgp_notify.code;
peer->notify.subcode = bgp_notify.subcode;
peer->notify.length = bgp_notify.length;
+ peer->notify.hard_reset = hard_reset;
if (bgp_notify.length && data) {
bgp_notify.data = XMALLOC(MTYPE_BGP_NOTIFICATION,
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 94c21e1861..4dcb22234a 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -3256,15 +3256,6 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_dest *dest,
if (!peer_established(pi->peer->connection))
continue;
- if (!bgp_path_info_nexthop_cmp(pi, new_select)) {
- if (debug)
- zlog_debug(
- "%pBD(%s): %s has the same nexthop as the bestpath, skip it",
- dest, bgp->name_pretty,
- path_buf);
- continue;
- }
-
bgp_path_info_cmp(bgp, pi, new_select, &paths_eq,
mpath_cfg, debug, pfx_buf, afi, safi,
&dest->reason);
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 81506f4410..869d2b4552 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -4507,6 +4507,12 @@ bool peer_active(struct peer *peer)
{
if (BGP_CONNECTION_SU_UNSPEC(peer->connection))
return false;
+
+ if (peer->bfd_config) {
+ if (bfd_session_is_down(peer->bfd_config->session))
+ return false;
+ }
+
if (peer->afc[AFI_IP][SAFI_UNICAST] || peer->afc[AFI_IP][SAFI_MULTICAST]
|| peer->afc[AFI_IP][SAFI_LABELED_UNICAST]
|| peer->afc[AFI_IP][SAFI_MPLS_VPN] || peer->afc[AFI_IP][SAFI_ENCAP]
diff --git a/doc/user/isisd.rst b/doc/user/isisd.rst
index 7412611869..3a0f277bf0 100644
--- a/doc/user/isisd.rst
+++ b/doc/user/isisd.rst
@@ -325,7 +325,7 @@ Showing ISIS information
Show topology IS-IS paths to Intermediate Systems, globally, in area
(level-1) or domain (level-2).
-.. clicmd:: show isis [vrf <NAME|all>] route [level-1|level-2] [prefix-sid|backup] [algorithm [(128-255)]]
+.. clicmd:: show isis [vrf <NAME|all>] route [level-1|level-2] [prefix-sid] [backup] [algorithm [(128-255)]]
Show the ISIS routing table, as determined by the most recent SPF
calculation.
diff --git a/doc/user/ldpd.rst b/doc/user/ldpd.rst
index cbed734e42..7a000a49c4 100644
--- a/doc/user/ldpd.rst
+++ b/doc/user/ldpd.rst
@@ -148,7 +148,7 @@ LDP Configuration
configured password. PASSWORD is a clear text password wit its digest sent
through the network.
-.. clicmd:: neighbor A.B.C.D holdtime HOLDTIME
+.. clicmd:: neighbor A.B.C.D session holdtime HOLDTIME
The following command located under MPLS router node configures the holdtime
value in seconds of the LDP neighbor ID. Configuring it triggers a keepalive
diff --git a/doc/user/nhrpd.rst b/doc/user/nhrpd.rst
index 54527a0c9a..648d56d9c1 100644
--- a/doc/user/nhrpd.rst
+++ b/doc/user/nhrpd.rst
@@ -84,6 +84,12 @@ Configuring NHRP
registration requests are sent. By default registrations are sent every one
third of the holdtime.
+.. clicmd:: ip nhrp authentication PASSWORD
+
+ Enables Cisco style authentication on NHRP packets. This embeds the
+ plaintext password to the outgoing NHRP packets.
+ Maximum length of the password is 8 characters.
+
.. clicmd:: ip nhrp map A.B.C.D|X:X::X:X A.B.C.D|local
Map an IP address of a station to the station's NBMA address.
diff --git a/isisd/isis_events.c b/isisd/isis_events.c
index 32231a079f..5574bbc50f 100644
--- a/isisd/isis_events.c
+++ b/isisd/isis_events.c
@@ -83,6 +83,7 @@ static void circuit_commence_level(struct isis_circuit *circuit, int level)
send_hello_sched(circuit, level, TRIGGERED_IIH_DELAY);
circuit->u.bc.lan_neighs[level - 1] = list_new();
+ circuit->u.bc.adjdb[level - 1] = list_new();
}
}
@@ -108,6 +109,10 @@ static void circuit_resign_level(struct isis_circuit *circuit, int level)
circuit->u.bc.is_dr[idx] = 0;
if (circuit->u.bc.lan_neighs[idx] != NULL)
list_delete(&circuit->u.bc.lan_neighs[idx]);
+ if (circuit->u.bc.adjdb[idx]) {
+ circuit->u.bc.adjdb[idx]->del = isis_delete_adj;
+ list_delete(&circuit->u.bc.adjdb[idx]);
+ }
}
return;
diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c
index e349373372..81201023d6 100644
--- a/isisd/isis_spf.c
+++ b/isisd/isis_spf.c
@@ -3074,7 +3074,7 @@ DEFUN(show_isis_route, show_isis_route_cmd,
#ifndef FABRICD
" [<level-1|level-2>]"
#endif /* ifndef FABRICD */
- " [<prefix-sid|backup>]"
+ " [prefix-sid] [backup]"
#ifndef FABRICD
" [algorithm [(128-255)]]"
#endif /* ifndef FABRICD */
diff --git a/lib/bfd.c b/lib/bfd.c
index 2222bb9547..4535fc1233 100644
--- a/lib/bfd.c
+++ b/lib/bfd.c
@@ -1334,3 +1334,9 @@ int bfd_nht_update(const struct prefix *match, const struct zapi_route *route)
return 0;
}
+
+bool bfd_session_is_down(const struct bfd_session_params *session)
+{
+ return session->bss.state == BSS_DOWN ||
+ session->bss.state == BSS_ADMIN_DOWN;
+}
diff --git a/lib/bfd.h b/lib/bfd.h
index bfa5287340..48929a9564 100644
--- a/lib/bfd.h
+++ b/lib/bfd.h
@@ -464,6 +464,8 @@ extern bool bfd_protocol_integration_shutting_down(void);
extern int bfd_nht_update(const struct prefix *match,
const struct zapi_route *route);
+extern bool bfd_session_is_down(const struct bfd_session_params *session);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/zclient.c b/lib/zclient.c
index 586ee9c2cb..0e832f0d8f 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -2182,6 +2182,7 @@ struct nexthop *nexthop_from_zapi_nexthop(const struct zapi_nexthop *znh)
n->ifindex = znh->ifindex;
n->gate = znh->gate;
n->srte_color = znh->srte_color;
+ n->weight = znh->weight;
/*
* This function currently handles labels
diff --git a/nhrpd/nhrp_interface.c b/nhrpd/nhrp_interface.c
index 7d0ab9762f..e81a2efbb6 100644
--- a/nhrpd/nhrp_interface.c
+++ b/nhrpd/nhrp_interface.c
@@ -99,6 +99,8 @@ static int nhrp_if_delete_hook(struct interface *ifp)
free(nifp->ipsec_fallback_profile);
if (nifp->source)
free(nifp->source);
+ if (nifp->auth_token)
+ zbuf_free(nifp->auth_token);
XFREE(MTYPE_NHRP_IF, ifp->info);
return 0;
diff --git a/nhrpd/nhrp_nhs.c b/nhrpd/nhrp_nhs.c
index f779f93486..b8958ba225 100644
--- a/nhrpd/nhrp_nhs.c
+++ b/nhrpd/nhrp_nhs.c
@@ -216,7 +216,7 @@ static void nhrp_reg_send_req(struct event *t)
cie->holding_time = htons(if_ad->holdtime);
cie->mtu = htons(if_ad->mtu);
- nhrp_ext_request(zb, hdr, ifp);
+ nhrp_ext_request(zb, hdr);
/* Cisco NAT detection extension */
if (sockunion_family(&r->proto_addr) != AF_UNSPEC) {
@@ -240,7 +240,7 @@ static void nhrp_reg_send_req(struct event *t)
cie->mtu = htons(if_ad->mtu);
nhrp_ext_complete(zb, ext);
- nhrp_packet_complete(zb, hdr);
+ nhrp_packet_complete(zb, hdr, ifp);
nhrp_peer_send(r->peer, zb);
zbuf_free(zb);
}
diff --git a/nhrpd/nhrp_packet.c b/nhrpd/nhrp_packet.c
index c6bd3bbbde..71f5c2f007 100644
--- a/nhrpd/nhrp_packet.c
+++ b/nhrpd/nhrp_packet.c
@@ -115,14 +115,32 @@ uint16_t nhrp_packet_calculate_checksum(const uint8_t *pdu, uint16_t len)
return (~csum) & 0xffff;
}
-void nhrp_packet_complete(struct zbuf *zb, struct nhrp_packet_header *hdr)
+void nhrp_packet_complete(struct zbuf *zb, struct nhrp_packet_header *hdr,
+ struct interface *ifp)
{
+ nhrp_packet_complete_auth(zb, hdr, ifp, true);
+}
+
+void nhrp_packet_complete_auth(struct zbuf *zb, struct nhrp_packet_header *hdr,
+ struct interface *ifp, bool auth)
+{
+ struct nhrp_interface *nifp = ifp->info;
+ struct zbuf *auth_token = nifp->auth_token;
+ struct nhrp_extension_header *dst;
unsigned short size;
+ if (auth && auth_token) {
+ dst = nhrp_ext_push(zb, hdr,
+ NHRP_EXTENSION_AUTHENTICATION |
+ NHRP_EXTENSION_FLAG_COMPULSORY);
+ zbuf_copy_peek(zb, auth_token, zbuf_size(auth_token));
+ nhrp_ext_complete(zb, dst);
+ }
+
if (hdr->extension_offset)
nhrp_ext_push(zb, hdr,
- NHRP_EXTENSION_END
- | NHRP_EXTENSION_FLAG_COMPULSORY);
+ NHRP_EXTENSION_END |
+ NHRP_EXTENSION_FLAG_COMPULSORY);
size = zb->tail - (uint8_t *)hdr;
hdr->packet_size = htons(size);
@@ -225,8 +243,7 @@ struct nhrp_extension_header *nhrp_ext_pull(struct zbuf *zb,
return ext;
}
-void nhrp_ext_request(struct zbuf *zb, struct nhrp_packet_header *hdr,
- struct interface *ifp)
+void nhrp_ext_request(struct zbuf *zb, struct nhrp_packet_header *hdr)
{
/* Place holders for standard extensions */
nhrp_ext_push(zb, hdr,
diff --git a/nhrpd/nhrp_peer.c b/nhrpd/nhrp_peer.c
index 6e7857c777..2414541bfa 100644
--- a/nhrpd/nhrp_peer.c
+++ b/nhrpd/nhrp_peer.c
@@ -603,7 +603,7 @@ static void nhrp_handle_resolution_req(struct nhrp_packet_parser *pp)
break;
}
}
- nhrp_packet_complete(zb, hdr);
+ nhrp_packet_complete(zb, hdr, ifp);
nhrp_peer_send(peer, zb);
err:
nhrp_peer_unref(peer);
@@ -730,7 +730,8 @@ static void nhrp_handle_registration_request(struct nhrp_packet_parser *p)
}
}
- nhrp_packet_complete(zb, hdr);
+ /* auth ext was validated and copied from the request */
+ nhrp_packet_complete_auth(zb, hdr, ifp, false);
nhrp_peer_send(p->peer, zb);
err:
zbuf_free(zb);
@@ -812,7 +813,7 @@ void nhrp_peer_send_indication(struct interface *ifp, uint16_t protocol_type,
/* Payload is the packet causing indication */
zbuf_copy(zb, pkt, zbuf_used(pkt));
- nhrp_packet_complete(zb, hdr);
+ nhrp_packet_complete(zb, hdr, ifp);
nhrp_peer_send(p, zb);
nhrp_peer_unref(p);
zbuf_free(zb);
@@ -1063,7 +1064,7 @@ static void nhrp_peer_forward(struct nhrp_peer *p,
nhrp_ext_complete(zb, dst);
}
- nhrp_packet_complete(zb, hdr);
+ nhrp_packet_complete_auth(zb, hdr, pp->ifp, false);
nhrp_peer_send(p, zb);
zbuf_free(zb);
zbuf_free(zb_copy);
@@ -1089,8 +1090,7 @@ static void nhrp_packet_debug(struct zbuf *zb, const char *dir)
reply = packet_types[hdr->type].type == PACKET_REPLY;
debugf(NHRP_DEBUG_COMMON, "%s %s(%d) %pSU -> %pSU", dir,
- (packet_types[hdr->type].name ? packet_types[hdr->type].name
- : "Unknown"),
+ (packet_types[hdr->type].name ? : "Unknown"),
hdr->type, reply ? &dst_proto : &src_proto,
reply ? &src_proto : &dst_proto);
}
@@ -1106,11 +1106,78 @@ static int proto2afi(uint16_t proto)
return AF_UNSPEC;
}
-struct nhrp_route_info {
- int local;
- struct interface *ifp;
- struct nhrp_vc *vc;
-};
+static int nhrp_packet_send_error(struct nhrp_packet_parser *pp,
+ uint16_t indication_code, uint16_t offset)
+{
+ union sockunion src_proto, dst_proto;
+ struct nhrp_packet_header *hdr;
+ struct zbuf *zb;
+
+ src_proto = pp->src_proto;
+ dst_proto = pp->dst_proto;
+ if (packet_types[pp->hdr->type].type != PACKET_REPLY) {
+ src_proto = pp->dst_proto;
+ dst_proto = pp->src_proto;
+ }
+ /* Create reply */
+ zb = zbuf_alloc(1500);
+ hdr = nhrp_packet_push(zb, NHRP_PACKET_ERROR_INDICATION, &pp->src_nbma,
+ &src_proto, &dst_proto);
+
+ hdr->u.error.code = htons(indication_code);
+ hdr->u.error.offset = htons(offset);
+ hdr->flags = pp->hdr->flags;
+ hdr->hop_count = 0; /* XXX: cisco returns 255 */
+
+ /* Payload is the packet causing error */
+ /* Don`t add extension according to RFC */
+ zbuf_put(zb, pp->hdr, sizeof(*pp->hdr));
+ zbuf_put(zb, sockunion_get_addr(&pp->src_nbma),
+ hdr->src_nbma_address_len);
+ zbuf_put(zb, sockunion_get_addr(&pp->src_proto),
+ hdr->src_protocol_address_len);
+ zbuf_put(zb, sockunion_get_addr(&pp->dst_proto),
+ hdr->dst_protocol_address_len);
+ nhrp_packet_complete_auth(zb, hdr, pp->ifp, false);
+
+ nhrp_peer_send(pp->peer, zb);
+ zbuf_free(zb);
+ return 0;
+}
+
+static bool nhrp_connection_authorized(struct nhrp_packet_parser *pp)
+{
+ struct nhrp_cisco_authentication_extension *auth_ext;
+ struct nhrp_interface *nifp = pp->ifp->info;
+ struct zbuf *auth = nifp->auth_token;
+ struct nhrp_extension_header *ext;
+ struct zbuf *extensions, pl;
+ int cmp = 1;
+
+ extensions = zbuf_alloc(zbuf_used(&pp->extensions));
+ zbuf_copy_peek(extensions, &pp->extensions, zbuf_used(&pp->extensions));
+ while ((ext = nhrp_ext_pull(extensions, &pl)) != NULL) {
+ switch (htons(ext->type) & ~NHRP_EXTENSION_FLAG_COMPULSORY) {
+ case NHRP_EXTENSION_AUTHENTICATION:
+ cmp = memcmp(auth->buf, pl.buf, zbuf_size(auth));
+ auth_ext = (struct nhrp_cisco_authentication_extension *)
+ auth->buf;
+ debugf(NHRP_DEBUG_COMMON,
+ "Processing Authentication Extension for (%s:%s|%d)",
+ auth_ext->secret,
+ ((struct nhrp_cisco_authentication_extension *)
+ pl.buf)
+ ->secret,
+ cmp);
+ break;
+ default:
+ /* Ignoring all received extensions except Authentication*/
+ break;
+ }
+ }
+ zbuf_free(extensions);
+ return cmp == 0;
+}
void nhrp_peer_recv(struct nhrp_peer *p, struct zbuf *zb)
{
@@ -1191,10 +1258,20 @@ void nhrp_peer_recv(struct nhrp_peer *p, struct zbuf *zb)
goto drop;
}
+ /* RFC2332 5.3.4 - Authentication is always done pairwise on an NHRP
+ * hop-by-hop basis; i.e. regenerated at each hop. */
nhrp_packet_debug(zb, "Recv");
-
- /* FIXME: Check authentication here. This extension needs to be
- * pre-handled. */
+ if (nifp->auth_token &&
+ (hdr->type != NHRP_PACKET_ERROR_INDICATION ||
+ hdr->u.error.code != NHRP_ERROR_AUTHENTICATION_FAILURE)) {
+ if (!nhrp_connection_authorized(&pp)) {
+ nhrp_packet_send_error(&pp,
+ NHRP_ERROR_AUTHENTICATION_FAILURE,
+ 0);
+ info = "authentication failure";
+ goto drop;
+ }
+ }
/* Figure out if this is local */
target_addr = (packet_types[hdr->type].type == PACKET_REPLY)
diff --git a/nhrpd/nhrp_shortcut.c b/nhrpd/nhrp_shortcut.c
index e83ce7f58f..9b47d974c3 100644
--- a/nhrpd/nhrp_shortcut.c
+++ b/nhrpd/nhrp_shortcut.c
@@ -425,7 +425,7 @@ static void nhrp_shortcut_send_resolution_req(struct nhrp_shortcut *s)
"Shortcut res_req: set cie ht to %u and mtu to %u. shortcut ht is %u",
ntohs(cie->holding_time), ntohs(cie->mtu), s->holding_time);
- nhrp_ext_request(zb, hdr, ifp);
+ nhrp_ext_request(zb, hdr);
/* Cisco NAT detection extension */
hdr->flags |= htons(NHRP_FLAG_RESOLUTION_NAT);
@@ -438,7 +438,7 @@ static void nhrp_shortcut_send_resolution_req(struct nhrp_shortcut *s)
nhrp_ext_complete(zb, ext);
}
- nhrp_packet_complete(zb, hdr);
+ nhrp_packet_complete(zb, hdr, ifp);
nhrp_peer_send(peer, zb);
nhrp_peer_unref(peer);
diff --git a/nhrpd/nhrp_vty.c b/nhrpd/nhrp_vty.c
index 40d38c44d2..b938ae4cf0 100644
--- a/nhrpd/nhrp_vty.c
+++ b/nhrpd/nhrp_vty.c
@@ -12,6 +12,9 @@
#include "nhrpd.h"
#include "netlink.h"
+#include "nhrp_protocol.h"
+
+#include "nhrpd/nhrp_vty_clippy.c"
static int nhrp_config_write(struct vty *vty);
static struct cmd_node zebra_node = {
@@ -459,6 +462,55 @@ DEFUN(if_no_nhrp_holdtime, if_no_nhrp_holdtime_cmd,
return CMD_SUCCESS;
}
+#define NHRP_CISCO_PASS_LEN 8
+DEFPY(if_nhrp_authentication, if_nhrp_authentication_cmd,
+ AFI_CMD "nhrp authentication PASSWORD$password",
+ AFI_STR
+ NHRP_STR
+ "Specify plain text password used for authenticantion\n"
+ "Password, plain text, limited to 8 characters\n")
+{
+ VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct nhrp_cisco_authentication_extension *auth;
+ struct nhrp_interface *nifp = ifp->info;
+ int pass_len = strlen(password);
+
+ if (pass_len > NHRP_CISCO_PASS_LEN) {
+ vty_out(vty, "Password size limit exceeded (%d>%d)\n",
+ pass_len, NHRP_CISCO_PASS_LEN);
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+
+ if (nifp->auth_token)
+ zbuf_free(nifp->auth_token);
+
+ nifp->auth_token = zbuf_alloc(pass_len + sizeof(uint32_t));
+ auth = (struct nhrp_cisco_authentication_extension *)
+ nifp->auth_token->buf;
+ auth->type = htonl(NHRP_AUTHENTICATION_PLAINTEXT);
+ memcpy(auth->secret, password, pass_len);
+
+ return CMD_SUCCESS;
+}
+
+
+DEFPY(if_no_nhrp_authentication, if_no_nhrp_authentication_cmd,
+ "no " AFI_CMD "nhrp authentication PASSWORD$password",
+ NO_STR
+ AFI_STR
+ NHRP_STR
+ "Specify plain text password used for authenticantion\n"
+ "Password, plain text, limited to 8 characters\n")
+{
+ VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct nhrp_interface *nifp = ifp->info;
+
+ if (nifp->auth_token)
+ zbuf_free(nifp->auth_token);
+ return CMD_SUCCESS;
+}
+
+
DEFUN(if_nhrp_mtu, if_nhrp_mtu_cmd,
"ip nhrp mtu <(576-1500)|opennhrp>",
IP_STR
@@ -1053,6 +1105,7 @@ DEFUN(show_dmvpn, show_dmvpn_cmd,
static void clear_nhrp_cache(struct nhrp_cache *c, void *data)
{
struct info_ctx *ctx = data;
+
if (c->cur.type <= NHRP_CACHE_DYNAMIC) {
nhrp_cache_update_binding(c, c->cur.type, -1, NULL, 0, NULL,
NULL);
@@ -1129,6 +1182,7 @@ static void interface_config_write_nhrp_map(struct nhrp_cache_config *c,
static int interface_config_write(struct vty *vty)
{
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
+ struct nhrp_cisco_authentication_extension *auth;
struct write_map_ctx mapctx;
struct interface *ifp;
struct nhrp_interface *nifp;
@@ -1155,6 +1209,12 @@ static int interface_config_write(struct vty *vty)
if (nifp->source)
vty_out(vty, " tunnel source %s\n", nifp->source);
+ if (nifp->auth_token) {
+ auth = (struct nhrp_cisco_authentication_extension *)
+ nifp->auth_token->buf;
+ vty_out(vty, " ip nhrp authentication %s\n", auth->secret);
+ }
+
for (afi = 0; afi < AFI_MAX; afi++) {
struct nhrp_afi_data *ad = &nifp->afi[afi];
@@ -1256,6 +1316,8 @@ void nhrp_config_init(void)
install_element(INTERFACE_NODE, &if_no_nhrp_network_id_cmd);
install_element(INTERFACE_NODE, &if_nhrp_holdtime_cmd);
install_element(INTERFACE_NODE, &if_no_nhrp_holdtime_cmd);
+ install_element(INTERFACE_NODE, &if_nhrp_authentication_cmd);
+ install_element(INTERFACE_NODE, &if_no_nhrp_authentication_cmd);
install_element(INTERFACE_NODE, &if_nhrp_mtu_cmd);
install_element(INTERFACE_NODE, &if_no_nhrp_mtu_cmd);
install_element(INTERFACE_NODE, &if_nhrp_flags_cmd);
diff --git a/nhrpd/nhrpd.h b/nhrpd/nhrpd.h
index e389b7489d..344e1d5178 100644
--- a/nhrpd/nhrpd.h
+++ b/nhrpd/nhrpd.h
@@ -311,6 +311,7 @@ DECLARE_DLIST(nhrp_reglist, struct nhrp_registration, reglist_entry);
struct nhrp_interface {
struct interface *ifp;
+ struct zbuf *auth_token;
unsigned enabled : 1;
char *ipsec_profile, *ipsec_fallback_profile, *source;
@@ -480,9 +481,13 @@ struct nhrp_packet_header *nhrp_packet_push(struct zbuf *zb, uint8_t type,
const union sockunion *src_nbma,
const union sockunion *src_proto,
const union sockunion *dst_proto);
-void nhrp_packet_complete(struct zbuf *zb, struct nhrp_packet_header *hdr);
uint16_t nhrp_packet_calculate_checksum(const uint8_t *pdu, uint16_t len);
+void nhrp_packet_complete(struct zbuf *zb, struct nhrp_packet_header *hdr,
+ struct interface *ifp);
+void nhrp_packet_complete_auth(struct zbuf *zb, struct nhrp_packet_header *hdr,
+ struct interface *ifp, bool auth);
+
struct nhrp_packet_header *nhrp_packet_pull(struct zbuf *zb,
union sockunion *src_nbma,
union sockunion *src_proto,
@@ -501,8 +506,7 @@ nhrp_ext_push(struct zbuf *zb, struct nhrp_packet_header *hdr, uint16_t type);
void nhrp_ext_complete(struct zbuf *zb, struct nhrp_extension_header *ext);
struct nhrp_extension_header *nhrp_ext_pull(struct zbuf *zb,
struct zbuf *payload);
-void nhrp_ext_request(struct zbuf *zb, struct nhrp_packet_header *hdr,
- struct interface *);
+void nhrp_ext_request(struct zbuf *zb, struct nhrp_packet_header *hdr);
int nhrp_ext_reply(struct zbuf *zb, struct nhrp_packet_header *hdr,
struct interface *ifp, struct nhrp_extension_header *ext,
struct zbuf *extpayload);
diff --git a/nhrpd/subdir.am b/nhrpd/subdir.am
index 227ff6c678..94fb3bb5be 100644
--- a/nhrpd/subdir.am
+++ b/nhrpd/subdir.am
@@ -42,3 +42,7 @@ noinst_HEADERS += \
nhrpd/zbuf.h \
nhrpd/znl.h \
# end
+
+clippy_scan += \
+ nhrpd/nhrp_vty.c \
+ # end
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 7cb51976f5..3a11b21232 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -3576,8 +3576,6 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
struct route_node *rn;
uint32_t bandwidth = ifp->bandwidth ? ifp->bandwidth : ifp->speed;
struct ospf_if_params *params;
- json_object *json_ois = NULL;
- json_object *json_oi = NULL;
/* Is interface up? */
if (use_json) {
@@ -3628,33 +3626,17 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
}
}
- if (use_json) {
- json_ois = json_object_new_object();
- json_object_object_add(json_interface_sub, "interfaceIp",
- json_ois);
- }
-
for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) {
struct ospf_interface *oi = rn->info;
if (oi == NULL)
continue;
-#if CONFDATE > 20240601
- CPP_NOTICE(
- "Use all fields following ospfEnabled from interfaceIp hierarchy")
-#endif
-
- if (use_json)
- json_oi = json_object_new_object();
-
if (CHECK_FLAG(oi->connected->flags, ZEBRA_IFA_UNNUMBERED)) {
- if (use_json) {
+ if (use_json)
json_object_boolean_true_add(json_interface_sub,
"ifUnnumbered");
- json_object_boolean_true_add(json_oi,
- "ifUnnumbered");
- } else
+ else
vty_out(vty, " This interface is UNNUMBERED,");
} else {
struct in_addr dest;
@@ -3668,13 +3650,6 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
json_object_int_add(json_interface_sub,
"ipAddressPrefixlen",
oi->address->prefixlen);
-
- json_object_string_addf(
- json_oi, "ipAddress", "%pI4",
- &oi->address->u.prefix4);
- json_object_int_add(json_oi,
- "ipAddressPrefixlen",
- oi->address->prefixlen);
} else
vty_out(vty, " Internet Address %pFX,",
oi->address);
@@ -3700,26 +3675,14 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
json_object_string_add(json_interface_sub,
"ospfIfType", dstr);
- json_object_string_add(json_oi, "ospfIfType",
- dstr);
-
- if (oi->type == OSPF_IFTYPE_VIRTUALLINK) {
+ if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
json_object_string_addf(
json_interface_sub, "vlinkPeer",
"%pI4", &dest);
-
- json_object_string_addf(json_oi,
- "vlinkPeer",
- "%pI4", &dest);
- } else {
+ else
json_object_string_addf(
json_interface_sub,
"localIfUsed", "%pI4", &dest);
-
- json_object_string_addf(json_oi,
- "localIfUsed",
- "%pI4", &dest);
- }
} else
vty_out(vty, " %s %pI4,", dstr,
&dest);
@@ -3728,16 +3691,10 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
json_object_string_add(json_interface_sub, "area",
ospf_area_desc_string(oi->area));
- json_object_string_add(json_oi, "area",
- ospf_area_desc_string(oi->area));
-
- if (OSPF_IF_PARAM(oi, mtu_ignore)) {
- json_object_boolean_true_add(
- json_oi, "mtuMismatchDetect");
+ if (OSPF_IF_PARAM(oi, mtu_ignore))
json_object_boolean_true_add(
json_interface_sub,
"mtuMismatchDetect");
- }
json_object_string_addf(json_interface_sub, "routerId",
"%pI4", &ospf->router_id);
@@ -3754,18 +3711,6 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
oi->state, NULL));
json_object_int_add(json_interface_sub, "priority",
PRIORITY(oi));
-
- json_object_string_addf(json_oi, "routerId", "%pI4",
- &ospf->router_id);
- json_object_string_add(json_oi, "networkType",
- ospf_network_type_str[oi->type]);
- json_object_int_add(json_oi, "cost", oi->output_cost);
- json_object_int_add(json_oi, "transmitDelaySecs",
- OSPF_IF_PARAM(oi, transmit_delay));
- json_object_string_add(json_oi, "state",
- lookup_msg(ospf_ism_state_msg,
- oi->state, NULL));
- json_object_int_add(json_oi, "priority", PRIORITY(oi));
json_object_boolean_add(
json_interface_sub, "opaqueCapable",
OSPF_IF_PARAM(oi, opaque_capable));
@@ -3809,13 +3754,6 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
json_interface_sub, "drAddress",
"%pI4",
&nbr->address.u.prefix4);
-
- json_object_string_addf(
- json_oi, "drId", "%pI4",
- &nbr->router_id);
- json_object_string_addf(
- json_oi, "drAddress", "%pI4",
- &nbr->address.u.prefix4);
} else {
vty_out(vty,
" Designated Router (ID) %pI4",
@@ -3841,13 +3779,6 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
json_interface_sub,
"bdrAddress", "%pI4",
&nbr->address.u.prefix4);
-
- json_object_string_addf(
- json_oi, "bdrId", "%pI4",
- &nbr->router_id);
- json_object_string_addf(
- json_oi, "bdrAddress", "%pI4",
- &nbr->address.u.prefix4);
} else {
vty_out(vty,
" Backup Designated Router (ID) %pI4,",
@@ -3863,43 +3794,28 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
if (oi->params
&& ntohl(oi->params->network_lsa_seqnum)
!= OSPF_INITIAL_SEQUENCE_NUMBER) {
- if (use_json) {
+ if (use_json)
json_object_int_add(
json_interface_sub,
"networkLsaSequence",
ntohl(oi->params->network_lsa_seqnum));
-
- json_object_int_add(
- json_oi, "networkLsaSequence",
- ntohl(oi->params->network_lsa_seqnum));
- } else {
+ else
vty_out(vty,
" Saved Network-LSA sequence number 0x%x\n",
ntohl(oi->params->network_lsa_seqnum));
- }
}
if (use_json) {
if (OI_MEMBER_CHECK(oi, MEMBER_ALLROUTERS)
|| OI_MEMBER_CHECK(oi, MEMBER_DROUTERS)) {
- if (OI_MEMBER_CHECK(oi, MEMBER_ALLROUTERS)) {
+ if (OI_MEMBER_CHECK(oi, MEMBER_ALLROUTERS))
json_object_boolean_true_add(
json_interface_sub,
"mcastMemberOspfAllRouters");
-
- json_object_boolean_true_add(
- json_oi,
- "mcastMemberOspfAllRouters");
- }
- if (OI_MEMBER_CHECK(oi, MEMBER_DROUTERS)) {
+ if (OI_MEMBER_CHECK(oi, MEMBER_DROUTERS))
json_object_boolean_true_add(
json_interface_sub,
"mcastMemberOspfDesignatedRouters");
-
- json_object_boolean_true_add(
- json_oi,
- "mcastMemberOspfDesignatedRouters");
- }
}
} else {
vty_out(vty, " Multicast group memberships:");
@@ -3915,23 +3831,14 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
}
if (use_json) {
- if (OSPF_IF_PARAM(oi, fast_hello) == 0) {
+ if (OSPF_IF_PARAM(oi, fast_hello) == 0)
json_object_int_add(
json_interface_sub, "timerMsecs",
OSPF_IF_PARAM(oi, v_hello) * 1000);
-
- json_object_int_add(json_oi, "timerMsecs",
- OSPF_IF_PARAM(oi, v_hello) *
- 1000);
- } else {
+ else
json_object_int_add(
json_interface_sub, "timerMsecs",
1000 / OSPF_IF_PARAM(oi, fast_hello));
-
- json_object_int_add(
- json_oi, "timerMsecs",
- 1000 / OSPF_IF_PARAM(oi, fast_hello));
- }
json_object_int_add(json_interface_sub, "timerDeadSecs",
OSPF_IF_PARAM(oi, v_wait));
json_object_int_add(json_interface_sub, "timerWaitSecs",
@@ -3939,14 +3846,6 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
json_object_int_add(
json_interface_sub, "timerRetransmitSecs",
OSPF_IF_PARAM(oi, retransmit_interval));
-
- json_object_int_add(json_oi, "timerDeadSecs",
- OSPF_IF_PARAM(oi, v_wait));
- json_object_int_add(json_oi, "timerWaitSecs",
- OSPF_IF_PARAM(oi, v_wait));
- json_object_int_add(
- json_oi, "timerRetransmitSecs",
- OSPF_IF_PARAM(oi, retransmit_interval));
} else {
vty_out(vty, " Timer intervals configured,");
vty_out(vty, " Hello ");
@@ -3975,23 +3874,17 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
json_object_int_add(json_interface_sub,
"timerHelloInMsecs",
time_store);
- json_object_int_add(json_oi,
- "timerHelloInMsecs",
- time_store);
} else
vty_out(vty, " Hello due in %s\n",
ospf_timer_dump(oi->t_hello, timebuf,
sizeof(timebuf)));
} else /* passive-interface is set */
{
- if (use_json) {
+ if (use_json)
json_object_boolean_true_add(
json_interface_sub,
"timerPassiveIface");
-
- json_object_boolean_true_add(
- json_oi, "timerPassiveIface");
- } else
+ else
vty_out(vty,
" No Hellos (Passive interface)\n");
}
@@ -4002,11 +3895,6 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
json_object_int_add(json_interface_sub,
"nbrAdjacentCount",
ospf_nbr_count(oi, NSM_Full));
-
- json_object_int_add(json_oi, "nbrCount",
- ospf_nbr_count(oi, 0));
- json_object_int_add(json_oi, "nbrAdjacentCount",
- ospf_nbr_count(oi, NSM_Full));
} else
vty_out(vty,
" Neighbor Count is %d, Adjacent neighbor count is %d\n",
@@ -4016,14 +3904,11 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
params = IF_DEF_PARAMS(ifp);
if (params &&
OSPF_IF_PARAM_CONFIGURED(params, v_gr_hello_delay)) {
- if (use_json) {
+ if (use_json)
json_object_int_add(json_interface_sub,
"grHelloDelaySecs",
params->v_gr_hello_delay);
-
- json_object_int_add(json_oi, "grHelloDelaySecs",
- params->v_gr_hello_delay);
- } else
+ else
vty_out(vty,
" Graceful Restart hello delay: %us\n",
params->v_gr_hello_delay);
@@ -4031,84 +3916,53 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
ospf_interface_bfd_show(vty, ifp, json_interface_sub);
- if (use_json) {
+ if (use_json)
json_object_boolean_add(json_interface_sub,
"prefixSuppression",
OSPF_IF_PARAM(oi,
prefix_suppression));
- json_object_boolean_add(json_oi, "prefixSuppression",
- OSPF_IF_PARAM(oi,
- prefix_suppression));
- } else {
- if (OSPF_IF_PARAM(oi, prefix_suppression))
- vty_out(vty,
- " Suppress advertisement of interface IP prefix\n");
- }
+ else if (OSPF_IF_PARAM(oi, prefix_suppression))
+ vty_out(vty,
+ " Suppress advertisement of interface IP prefix\n");
/* OSPF Authentication information */
ospf_interface_auth_show(vty, oi, json_interface_sub, use_json);
- ospf_interface_auth_show(vty, oi, json_oi, use_json);
-
/* Point-to-Multipoint Interface options. */
if (oi->type == OSPF_IFTYPE_POINTOMULTIPOINT) {
- if (use_json) {
+ if (use_json)
json_object_boolean_add(json_interface_sub,
"p2mpDelayReflood",
oi->p2mp_delay_reflood);
-
- json_object_boolean_add(json_oi,
- "p2mpDelayReflood",
- oi->p2mp_delay_reflood);
- } else {
+ else
vty_out(vty,
" %sDelay reflooding LSAs received on P2MP interface\n",
oi->p2mp_delay_reflood ? "" : "Don't ");
- }
- if (use_json) {
+ if (use_json)
json_object_boolean_add(json_interface_sub,
"p2mpNonBroadcast",
oi->p2mp_non_broadcast);
-
- json_object_boolean_add(json_oi,
- "p2mpNonBroadcast",
- oi->p2mp_non_broadcast);
- } else {
+ else
vty_out(vty,
" P2MP interface does %ssupport broadcast\n",
oi->p2mp_non_broadcast ? "not " : "");
- }
}
- /* Add ospf_interface object to main json blob using SIP as key
- */
- if (use_json)
- json_object_object_addf(json_ois, json_oi, "%pI4",
- &oi->address->u.prefix4);
-
if (oi->nbr_filter) {
- if (use_json) {
+ if (use_json)
json_object_string_add(json_interface_sub,
"nbrFilterPrefixList",
prefix_list_name(
oi->nbr_filter));
- json_object_string_add(json_oi,
- "nbrFilterPrefixList",
- prefix_list_name(
- oi->nbr_filter));
- } else
+ else
vty_out(vty,
" Neighbor filter prefix-list: %s\n",
prefix_list_name(oi->nbr_filter));
} else {
- if (use_json) {
+ if (use_json)
json_object_string_add(json_interface_sub,
"nbrFilterPrefixList",
"N/A");
- json_object_string_add(json_oi,
- "nbrFilterPrefixList",
- "N/A");
- }
}
}
}
diff --git a/tests/topotests/bfd_topo3/test_bfd_topo3.py b/tests/topotests/bfd_topo3/test_bfd_topo3.py
index d7b2542f9f..a899a2b464 100644
--- a/tests/topotests/bfd_topo3/test_bfd_topo3.py
+++ b/tests/topotests/bfd_topo3/test_bfd_topo3.py
@@ -95,7 +95,7 @@ def expect_route_missing(router, iptype, route):
"show {} route json".format(iptype),
{route: None},
)
- rv, result = topotest.run_and_expect(test_func, None, count=20, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=20, wait=1)
assertmsg = '"{}" convergence failure'.format(router)
assert result is None, assertmsg
diff --git a/tests/topotests/bfd_vrf_topo1/test_bfd_vrf_topo1.py b/tests/topotests/bfd_vrf_topo1/test_bfd_vrf_topo1.py
index 9e5a68f0a3..f6adff61d0 100644
--- a/tests/topotests/bfd_vrf_topo1/test_bfd_vrf_topo1.py
+++ b/tests/topotests/bfd_vrf_topo1/test_bfd_vrf_topo1.py
@@ -61,7 +61,7 @@ def setup_module(mod):
router_list = tgen.routers()
# check for zebra capability
- for rname, router in router_list.items():
+ for _, router in router_list.items():
if router.check_capability(TopoRouter.RD_ZEBRA, "--vrfwnetns") == False:
return pytest.skip(
"Skipping BFD Topo1 VRF NETNS feature. VRF NETNS backend not available on FRR"
diff --git a/tests/topotests/bgp_accept_own/test_bgp_accept_own.py b/tests/topotests/bgp_accept_own/test_bgp_accept_own.py
index d294da0934..11b24baa82 100644
--- a/tests/topotests/bgp_accept_own/test_bgp_accept_own.py
+++ b/tests/topotests/bgp_accept_own/test_bgp_accept_own.py
@@ -68,7 +68,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_addpath_best_selected/test_bgp_addpath_best_selected.py b/tests/topotests/bgp_addpath_best_selected/test_bgp_addpath_best_selected.py
index 2a610c901e..3d17a2b709 100644
--- a/tests/topotests/bgp_addpath_best_selected/test_bgp_addpath_best_selected.py
+++ b/tests/topotests/bgp_addpath_best_selected/test_bgp_addpath_best_selected.py
@@ -51,7 +51,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_aggregate_address_matching_med/test_bgp_aggregate_address_matching_med.py b/tests/topotests/bgp_aggregate_address_matching_med/test_bgp_aggregate_address_matching_med.py
index 5a4a5fb657..0520b5e136 100644
--- a/tests/topotests/bgp_aggregate_address_matching_med/test_bgp_aggregate_address_matching_med.py
+++ b/tests/topotests/bgp_aggregate_address_matching_med/test_bgp_aggregate_address_matching_med.py
@@ -49,7 +49,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_aggregate_address_origin/test_bgp_aggregate-address_origin.py b/tests/topotests/bgp_aggregate_address_origin/test_bgp_aggregate-address_origin.py
index 739685d417..188bbd0b98 100644
--- a/tests/topotests/bgp_aggregate_address_origin/test_bgp_aggregate-address_origin.py
+++ b/tests/topotests/bgp_aggregate_address_origin/test_bgp_aggregate-address_origin.py
@@ -49,7 +49,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -89,12 +89,12 @@ def test_bgp_aggregate_address_origin():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_converge, router)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert result is None, 'Failed to see bgp convergence in "{}"'.format(router)
test_func = functools.partial(_bgp_aggregate_address_has_metric, router)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert (
result is None
diff --git a/tests/topotests/bgp_aggregate_address_route_map/test_bgp_aggregate-address_route-map.py b/tests/topotests/bgp_aggregate_address_route_map/test_bgp_aggregate-address_route-map.py
index eeac7146b1..2343440aaf 100644
--- a/tests/topotests/bgp_aggregate_address_route_map/test_bgp_aggregate-address_route-map.py
+++ b/tests/topotests/bgp_aggregate_address_route_map/test_bgp_aggregate-address_route-map.py
@@ -52,7 +52,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_aggregator_zero/test_bgp_aggregator_zero.py b/tests/topotests/bgp_aggregator_zero/test_bgp_aggregator_zero.py
index d9ef3e1ce1..1a52f8c90e 100644
--- a/tests/topotests/bgp_aggregator_zero/test_bgp_aggregator_zero.py
+++ b/tests/topotests/bgp_aggregator_zero/test_bgp_aggregator_zero.py
@@ -73,7 +73,7 @@ def test_bgp_aggregator_zero():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_converge)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, 'Failed bgp convergence in "{}"'.format(tgen.gears["r1"])
@@ -99,7 +99,7 @@ def test_bgp_aggregator_zero():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_has_correct_aggregator_route_with_good_asn)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, 'Aggregator AS attribute not found in "{}"'.format(
tgen.gears["r1"]
diff --git a/tests/topotests/bgp_aigp/test_bgp_aigp.py b/tests/topotests/bgp_aigp/test_bgp_aigp.py
index 655e9ad184..e3b32da164 100644
--- a/tests/topotests/bgp_aigp/test_bgp_aigp.py
+++ b/tests/topotests/bgp_aigp/test_bgp_aigp.py
@@ -73,7 +73,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_as_override/test_bgp_as_override.py b/tests/topotests/bgp_as_override/test_bgp_as_override.py
index 7cb4f81cfc..dbbdf2c88f 100644
--- a/tests/topotests/bgp_as_override/test_bgp_as_override.py
+++ b/tests/topotests/bgp_as_override/test_bgp_as_override.py
@@ -49,7 +49,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_as_wide_bgp_identifier/test_bgp_as_wide_bgp_identifier.py b/tests/topotests/bgp_as_wide_bgp_identifier/test_bgp_as_wide_bgp_identifier.py
index 5c09a6b0e0..e8e3b4171a 100644
--- a/tests/topotests/bgp_as_wide_bgp_identifier/test_bgp_as_wide_bgp_identifier.py
+++ b/tests/topotests/bgp_as_wide_bgp_identifier/test_bgp_as_wide_bgp_identifier.py
@@ -48,7 +48,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -85,12 +85,12 @@ def test_bgp_as_wide_bgp_identifier():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_converge, tgen.gears["r1"])
- success, result = topotest.run_and_expect(test_func, None, count=260, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=260, wait=0.5)
assert result is None, 'Failed to converge: "{}"'.format(tgen.gears["r1"])
test_func = functools.partial(_bgp_failed, tgen.gears["r3"])
- success, result = topotest.run_and_expect(test_func, None, count=260, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=260, wait=0.5)
assert result is None, 'Bad BGP Identifier notification not sent: "{}"'.format(
tgen.gears["r3"]
diff --git a/tests/topotests/bgp_asdot_regex/test_bgp_asdot_regex.py b/tests/topotests/bgp_asdot_regex/test_bgp_asdot_regex.py
index 4883e847c9..09803dfa84 100644
--- a/tests/topotests/bgp_asdot_regex/test_bgp_asdot_regex.py
+++ b/tests/topotests/bgp_asdot_regex/test_bgp_asdot_regex.py
@@ -60,7 +60,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -97,7 +97,7 @@ def test_bgp_asdot_regex():
logger.info("Check if neighbor sessions are up in {}".format(router1.name))
test_func = partial(_bgp_converge, router1)
- success, result = topotest.run_and_expect(test_func, None, count=15, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=15, wait=0.5)
assert result is None, 'Failed to see BGP convergence in "{}"'.format(router1.name)
logger.info("BGP neighbor session is up in {}".format(router1.name))
diff --git a/tests/topotests/bgp_aspath_zero/test_bgp_aspath_zero.py b/tests/topotests/bgp_aspath_zero/test_bgp_aspath_zero.py
index 0f1a08308f..fe89a87621 100644
--- a/tests/topotests/bgp_aspath_zero/test_bgp_aspath_zero.py
+++ b/tests/topotests/bgp_aspath_zero/test_bgp_aspath_zero.py
@@ -73,7 +73,7 @@ def test_bgp_aggregator_zero():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_converge)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, "More than one prefix seen at r1, SHOULD be only one."
def _bgp_has_correct_routes_without_asn_0():
@@ -82,7 +82,7 @@ def test_bgp_aggregator_zero():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_has_correct_routes_without_asn_0)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, "Failed listing 192.168.100.101/32, SHOULD be accepted."
diff --git a/tests/topotests/bgp_auth/test_bgp_auth1.py b/tests/topotests/bgp_auth/test_bgp_auth1.py
index 9d47106c07..c19a740a92 100644
--- a/tests/topotests/bgp_auth/test_bgp_auth1.py
+++ b/tests/topotests/bgp_auth/test_bgp_auth1.py
@@ -156,7 +156,7 @@ def setup_module(mod):
router_list = tgen.routers()
# For all registered routers, load the zebra configuration file
- for rname, router in router_list.items():
+ for _, router in router_list.items():
router.load_config(TopoRouter.RD_ZEBRA, "zebra.conf")
router.load_config(TopoRouter.RD_OSPF, "")
router.load_config(TopoRouter.RD_BGP, "")
diff --git a/tests/topotests/bgp_auth/test_bgp_auth2.py b/tests/topotests/bgp_auth/test_bgp_auth2.py
index 6b92036727..2551c1c35b 100644
--- a/tests/topotests/bgp_auth/test_bgp_auth2.py
+++ b/tests/topotests/bgp_auth/test_bgp_auth2.py
@@ -156,7 +156,7 @@ def setup_module(mod):
router_list = tgen.routers()
# For all registered routers, load the zebra configuration file
- for rname, router in router_list.items():
+ for _, router in router_list.items():
router.load_config(TopoRouter.RD_ZEBRA, "zebra.conf")
router.load_config(TopoRouter.RD_OSPF, "")
router.load_config(TopoRouter.RD_BGP, "")
diff --git a/tests/topotests/bgp_auth/test_bgp_auth3.py b/tests/topotests/bgp_auth/test_bgp_auth3.py
index 2237c6b1b6..dc4f61d3c9 100644
--- a/tests/topotests/bgp_auth/test_bgp_auth3.py
+++ b/tests/topotests/bgp_auth/test_bgp_auth3.py
@@ -155,7 +155,7 @@ def setup_module(mod):
router_list = tgen.routers()
# For all registered routers, load the zebra configuration file
- for rname, router in router_list.items():
+ for _, router in router_list.items():
router.load_config(TopoRouter.RD_ZEBRA, "zebra.conf")
router.load_config(TopoRouter.RD_OSPF, "")
router.load_config(TopoRouter.RD_BGP, "")
diff --git a/tests/topotests/bgp_auth/test_bgp_auth4.py b/tests/topotests/bgp_auth/test_bgp_auth4.py
index d6fe42504b..afe4441e13 100644
--- a/tests/topotests/bgp_auth/test_bgp_auth4.py
+++ b/tests/topotests/bgp_auth/test_bgp_auth4.py
@@ -155,7 +155,7 @@ def setup_module(mod):
router_list = tgen.routers()
# For all registered routers, load the zebra configuration file
- for rname, router in router_list.items():
+ for _, router in router_list.items():
router.load_config(TopoRouter.RD_ZEBRA, "zebra.conf")
router.load_config(TopoRouter.RD_OSPF, "")
router.load_config(TopoRouter.RD_BGP, "")
diff --git a/tests/topotests/bgp_bfd_down_cease_notification/r1/bfdd.conf b/tests/topotests/bgp_bfd_down_cease_notification/r1/bfdd.conf
index 0ae384eb53..1033b27c56 100644
--- a/tests/topotests/bgp_bfd_down_cease_notification/r1/bfdd.conf
+++ b/tests/topotests/bgp_bfd_down_cease_notification/r1/bfdd.conf
@@ -1,5 +1,9 @@
bfd
+ profile r1
+ exit
+ !
peer 192.168.255.2 interface r1-eth0
+ profile r1
exit
!
exit
diff --git a/tests/topotests/bgp_bfd_down_cease_notification/r1/bgpd.conf b/tests/topotests/bgp_bfd_down_cease_notification/r1/bgpd.conf
index e855f75c20..58a90d1a49 100644
--- a/tests/topotests/bgp_bfd_down_cease_notification/r1/bgpd.conf
+++ b/tests/topotests/bgp_bfd_down_cease_notification/r1/bgpd.conf
@@ -3,7 +3,7 @@ router bgp 65001
neighbor 192.168.255.2 remote-as external
neighbor 192.168.255.2 timers 3 10
neighbor 192.168.255.2 timers connect 1
- neighbor 192.168.255.2 bfd
+ neighbor 192.168.255.2 bfd profile r1
neighbor 192.168.255.2 passive
address-family ipv4
redistribute connected
diff --git a/tests/topotests/bgp_bfd_down_cease_notification/test_bgp_bfd_down_cease_notification.py b/tests/topotests/bgp_bfd_down_cease_notification/test_bgp_bfd_down_cease_notification.py
index 00142981c5..f18e8bd388 100644
--- a/tests/topotests/bgp_bfd_down_cease_notification/test_bgp_bfd_down_cease_notification.py
+++ b/tests/topotests/bgp_bfd_down_cease_notification/test_bgp_bfd_down_cease_notification.py
@@ -45,7 +45,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -89,6 +89,9 @@ def test_bgp_bfd_down_notification():
"192.168.255.1": {
"lastNotificationReason": "Cease/BFD Down",
"lastNotificationHardReset": True,
+ "peerBfdInfo": {
+ "status": "Up",
+ },
}
}
return topotest.json_cmp(output, expected)
diff --git a/tests/topotests/bgp_bfd_down_cease_notification/test_bgp_bfd_down_cease_notification_shutdown.py b/tests/topotests/bgp_bfd_down_cease_notification/test_bgp_bfd_down_cease_notification_shutdown.py
new file mode 100644
index 0000000000..5ffeed5033
--- /dev/null
+++ b/tests/topotests/bgp_bfd_down_cease_notification/test_bgp_bfd_down_cease_notification_shutdown.py
@@ -0,0 +1,122 @@
+#!/usr/bin/env python
+# SPDX-License-Identifier: ISC
+
+#
+# bgp_bfd_down_cease_notification_shutdown.py
+#
+# Copyright (c) 2024 by
+# Donatas Abraitis <donatas@opensourcerouting.org>
+#
+
+"""
+Check if Cease/BFD Down notification message is sent/received
+when the BFD is down (administratively).
+"""
+
+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 kill_router_daemons, step
+
+pytestmark = [pytest.mark.bfdd, pytest.mark.bgpd]
+
+
+def build_topo(tgen):
+ for routern in range(1, 3):
+ tgen.add_router("r{}".format(routern))
+
+ switch = tgen.add_switch("s1")
+ switch.add_link(tgen.gears["r1"])
+ switch.add_link(tgen.gears["r2"])
+
+
+def setup_module(mod):
+ tgen = Topogen(build_topo, mod.__name__)
+ tgen.start_topology()
+
+ 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))
+ )
+ router.load_config(
+ TopoRouter.RD_BFD, os.path.join(CWD, "{}/bfdd.conf".format(rname))
+ )
+
+ tgen.start_router()
+
+
+def teardown_module(mod):
+ tgen = get_topogen()
+ tgen.stop_topology()
+
+
+def test_bgp_bfd_down_notification_shutdown():
+ tgen = get_topogen()
+
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ r1 = tgen.gears["r1"]
+ r2 = tgen.gears["r2"]
+
+ def _bgp_converge():
+ output = json.loads(r2.vtysh_cmd("show ip bgp neighbor 192.168.255.1 json"))
+ expected = {
+ "192.168.255.1": {
+ "bgpState": "Established",
+ "addressFamilyInfo": {"ipv4Unicast": {"acceptedPrefixCounter": 2}},
+ "peerBfdInfo": {"status": "Up"},
+ }
+ }
+ return topotest.json_cmp(output, expected)
+
+ def _bgp_bfd_down_notification():
+ output = json.loads(r2.vtysh_cmd("show ip bgp neighbor 192.168.255.1 json"))
+ expected = {
+ "192.168.255.1": {
+ "lastNotificationReason": "Cease/BFD Down",
+ "lastNotificationHardReset": True,
+ "peerBfdInfo": {
+ "status": "Down",
+ },
+ }
+ }
+ return topotest.json_cmp(output, expected)
+
+ step("Initial BGP converge")
+ test_func = functools.partial(_bgp_converge)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
+ assert result is None, "Failed to see BGP convergence on R2"
+
+ r1.vtysh_cmd(
+ """
+ configure
+ bfd
+ profile r1
+ shutdown
+ """
+ )
+
+ step("Check if we received Cease/BFD Down notification message")
+ test_func = functools.partial(_bgp_bfd_down_notification)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
+ assert result is None, "Failed to see BGP Cease/BFD Down notification message on R2"
+
+
+if __name__ == "__main__":
+ args = ["-s"] + sys.argv[1:]
+ sys.exit(pytest.main(args))
diff --git a/tests/topotests/bgp_blackhole_community/test_bgp_blackhole_community.py b/tests/topotests/bgp_blackhole_community/test_bgp_blackhole_community.py
index 9f5c0ef924..05a9a1e7f6 100644
--- a/tests/topotests/bgp_blackhole_community/test_bgp_blackhole_community.py
+++ b/tests/topotests/bgp_blackhole_community/test_bgp_blackhole_community.py
@@ -51,7 +51,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -125,14 +125,14 @@ def test_bgp_blackhole_community():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_converge)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, 'Failed bgp convergence in "{}"'.format(tgen.gears["r2"])
step("Check if 172.16.255.254/32 is not advertised to eBGP peers")
test_func = functools.partial(_bgp_no_advertise_ebgp)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert (
result is None
@@ -142,7 +142,7 @@ def test_bgp_blackhole_community():
step("Check if 172.16.255.254/32 is advertised to iBGP peers")
test_func = functools.partial(_bgp_no_advertise_ibgp)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert (
result is None
@@ -152,7 +152,7 @@ def test_bgp_blackhole_community():
step("Verify if the nexthop set via route-map on r4 is marked valid")
test_func = functools.partial(_bgp_verify_nexthop_validity)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, 'Nexthops are not valid "{}"'.format(tgen.gears["r4"])
diff --git a/tests/topotests/bgp_comm_list_delete/test_bgp_comm-list_delete.py b/tests/topotests/bgp_comm_list_delete/test_bgp_comm-list_delete.py
index efc8f200a3..2064dac6e6 100644
--- a/tests/topotests/bgp_comm_list_delete/test_bgp_comm-list_delete.py
+++ b/tests/topotests/bgp_comm_list_delete/test_bgp_comm-list_delete.py
@@ -48,7 +48,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_comm_list_match/test_bgp_comm_list_match.py b/tests/topotests/bgp_comm_list_match/test_bgp_comm_list_match.py
index de69ea9387..d0cab26e1a 100644
--- a/tests/topotests/bgp_comm_list_match/test_bgp_comm_list_match.py
+++ b/tests/topotests/bgp_comm_list_match/test_bgp_comm_list_match.py
@@ -56,7 +56,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_community_alias/test_bgp-community-alias.py b/tests/topotests/bgp_community_alias/test_bgp-community-alias.py
index fdae9a3aa7..9df73a51ba 100644
--- a/tests/topotests/bgp_community_alias/test_bgp-community-alias.py
+++ b/tests/topotests/bgp_community_alias/test_bgp-community-alias.py
@@ -40,7 +40,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -92,7 +92,7 @@ def test_bgp_community_alias():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_converge, router)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, "Cannot see BGP community aliases at r1"
def _bgp_show_prefixes_by_alias(router):
@@ -118,7 +118,7 @@ def test_bgp_community_alias():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_show_prefixes_by_alias, router)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, "Cannot see BGP prefixes by community alias at r1"
def _bgp_show_prefixes_by_large_community_list(router):
@@ -129,7 +129,7 @@ def test_bgp_community_alias():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_show_prefixes_by_large_community_list, router)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, "Cannot see BGP prefixes by large community list at r1"
diff --git a/tests/topotests/bgp_community_change_update/test_bgp_community_change_update.py b/tests/topotests/bgp_community_change_update/test_bgp_community_change_update.py
index 5ad15e0645..c0a92efba9 100644
--- a/tests/topotests/bgp_community_change_update/test_bgp_community_change_update.py
+++ b/tests/topotests/bgp_community_change_update/test_bgp_community_change_update.py
@@ -97,7 +97,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -133,7 +133,7 @@ def test_bgp_community_update_path_change():
step("Check if an initial topology is converged")
test_func = functools.partial(_bgp_converge_initial)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, "Failed to see bgp convergence in c1"
step("Disable link between y1 and y2")
@@ -146,7 +146,7 @@ def test_bgp_community_update_path_change():
step("Check if a topology is converged after a link down between y1 and y2")
test_func = functools.partial(_bgp_converge_link_disabled)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, "Failed to see bgp convergence in y1"
def _bgp_check_for_duplicate_updates():
@@ -193,7 +193,7 @@ def test_bgp_community_update_path_change():
step("Check if a topology is converged after a link up between y1 and y2")
test_func = functools.partial(_bgp_converge_link_enabled)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, "Failed to see bgp convergence in y1"
step(
diff --git a/tests/topotests/bgp_conditional_advertisement/test_bgp_conditional_advertisement.py b/tests/topotests/bgp_conditional_advertisement/test_bgp_conditional_advertisement.py
index 0128c88349..577bf9fd76 100644
--- a/tests/topotests/bgp_conditional_advertisement/test_bgp_conditional_advertisement.py
+++ b/tests/topotests/bgp_conditional_advertisement/test_bgp_conditional_advertisement.py
@@ -159,7 +159,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -426,7 +426,7 @@ def test_bgp_conditional_advertisement_tc_2_1():
)
test_func = functools.partial(exist_map_routes_present, router3)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = 'TC21: exist-map routes present in "router2" BGP table - '
assert result is None, msg + failed
@@ -455,7 +455,7 @@ def test_bgp_conditional_advertisement_tc_2_2():
)
test_func = functools.partial(exist_map_routes_not_present, router3)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = 'TC22: exist-map routes not present in "router2" BGP table - '
assert result is None, msg + failed
@@ -484,7 +484,7 @@ def test_bgp_conditional_advertisement_tc_2_3():
)
test_func = functools.partial(default_route_withdrawn, router3)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = "TC23: advertise-map with exist-map configuration is removed from peer - "
assert result is None, msg + failed
@@ -513,7 +513,7 @@ def test_bgp_conditional_advertisement_tc_3_1():
)
test_func = functools.partial(non_exist_map_routes_not_present, router3)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = 'TC31: non-exist-map routes not present in "router2" BGP table - '
assert result is None, msg + failed
@@ -542,7 +542,7 @@ def test_bgp_conditional_advertisement_tc_3_2():
)
test_func = functools.partial(non_exist_map_routes_present, router3)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = 'TC32: non-exist-map routes present in "router2" BGP table - '
assert result is None, msg + failed
@@ -571,7 +571,7 @@ def test_bgp_conditional_advertisement_tc_3_3():
)
test_func = functools.partial(all_routes_advertised, router3)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = (
"TC33: advertise-map with non-exist-map configuration is removed from a peer - "
@@ -603,7 +603,7 @@ def test_bgp_conditional_advertisement_tc_4_1():
)
test_func = functools.partial(non_exist_map_no_condition_route_map, router3)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = 'TC41: non-exist-map route-map removed in "router2" - '
assert result is None, msg + failed
@@ -632,7 +632,7 @@ def test_bgp_conditional_advertisement_tc_4_2():
)
test_func = functools.partial(exist_map_no_condition_route_map, router3)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = 'TC42: exist-map route-map removed in "router2" - '
assert result is None, msg + failed
@@ -665,7 +665,7 @@ def test_bgp_conditional_advertisement_tc_5_1():
)
test_func = functools.partial(exist_map_routes_present_rmap_filter, router3)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = "TC51: exist-map routes present with route-map filter - "
assert result is None, msg + failed
@@ -694,7 +694,7 @@ def test_bgp_conditional_advertisement_tc_5_2():
)
test_func = functools.partial(exist_map_routes_present_no_rmap_filter, router3)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = "TC52: exist-map routes present, no route-map filter - "
assert result is None, msg + failed
@@ -724,7 +724,7 @@ def test_bgp_conditional_advertisement_tc_5_3():
)
test_func = functools.partial(non_exist_map_routes_present_rmap_filter, router3)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = "TC53: non-exist-map routes present, with route-map filter - "
assert result is None, msg + failed
@@ -753,7 +753,7 @@ def test_bgp_conditional_advertisement_tc_5_4():
)
test_func = functools.partial(non_exist_map_routes_present_no_rmap_filter, router3)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = "TC54: non-exist-map routes present, no route-map filter - "
assert result is None, msg + failed
@@ -791,7 +791,7 @@ def test_bgp_conditional_advertisement_tc_6_1():
)
test_func = functools.partial(exist_map_routes_not_present_rmap_filter, router3)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = "TC61: exist-map routes not present, route-map filter - "
assert result is None, msg + failed
@@ -820,7 +820,7 @@ def test_bgp_conditional_advertisement_tc_6_2():
)
test_func = functools.partial(exist_map_routes_not_present_no_rmap_filter, router3)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = "TC62: exist-map routes not present, no route-map filter - "
assert result is None, msg + failed
@@ -850,7 +850,7 @@ def test_bgp_conditional_advertisement_tc_6_3():
)
test_func = functools.partial(non_exist_map_routes_not_present_rmap_filter, router3)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = "TC63: non-exist-map routes not present, route-map filter - "
assert result is None, msg + failed
@@ -881,7 +881,7 @@ def test_bgp_conditional_advertisement_tc_6_4():
test_func = functools.partial(
non_exist_map_routes_not_present_no_rmap_filter, router3
)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = "TC64: non-exist-map routes not present, no route-map filter - "
assert result is None, msg + failed
@@ -919,7 +919,7 @@ def test_bgp_conditional_advertisement_tc_7_1():
)
test_func = functools.partial(exist_map_routes_present_rmap2_filter, router3)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = "TC71: exist-map routes present, route-map filter - "
assert result is None, msg + failed
@@ -948,7 +948,7 @@ def test_bgp_conditional_advertisement_tc_7_2():
)
test_func = functools.partial(exist_map_routes_present_no_rmap2_filter, router3)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = "TC72: exist-map routes present, no route-map filter - "
assert result is None, msg + failed
@@ -978,7 +978,7 @@ def test_bgp_conditional_advertisement_tc_7_3():
)
test_func = functools.partial(non_exist_map_routes_present_rmap2_filter, router3)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = "TC73: non-exist-map routes present, route-map filter - "
assert result is None, msg + failed
@@ -1007,7 +1007,7 @@ def test_bgp_conditional_advertisement_tc_7_4():
)
test_func = functools.partial(non_exist_map_routes_present_no_rmap2_filter, router3)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = "TC74: non-exist-map routes present, no route-map filter - "
assert result is None, msg + failed
@@ -1045,7 +1045,7 @@ def test_bgp_conditional_advertisement_tc_8_1():
)
test_func = functools.partial(exist_map_routes_not_present_rmap2_filter, router3)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = "TC81: exist-map routes not present, route-map filter - "
assert result is None, msg + failed
@@ -1074,7 +1074,7 @@ def test_bgp_conditional_advertisement_tc_8_2():
)
test_func = functools.partial(exist_map_routes_not_present_no_rmap2_filter, router3)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = "TC82: exist-map routes not present, no route-map filter - "
assert result is None, msg + failed
@@ -1106,7 +1106,7 @@ def test_bgp_conditional_advertisement_tc_8_3():
test_func = functools.partial(
non_exist_map_routes_not_present_rmap2_filter, router3
)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = "TC83: non-exist-map routes not present, route-map filter - "
assert result is None, msg + failed
@@ -1137,7 +1137,7 @@ def test_bgp_conditional_advertisement_tc_8_4():
test_func = functools.partial(
non_exist_map_routes_not_present_no_rmap2_filter, router3
)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = "TC84: non-exist-map routes not present, no route-map filter - "
assert result is None, msg + failed
@@ -1175,7 +1175,7 @@ def test_bgp_conditional_advertisement_tc_9_1():
)
test_func = functools.partial(exist_map_routes_present_rmap2_network, router3)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = "TC91: exist-map routes present, route-map filter and network - "
assert result is None, msg + failed
@@ -1204,7 +1204,7 @@ def test_bgp_conditional_advertisement_tc_9_2():
)
test_func = functools.partial(exist_map_routes_present_rmap2_no_network, router3)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = "TC92: exist-map routes present, route-map filter and no network - "
assert result is None, msg + failed
@@ -1244,7 +1244,7 @@ def test_bgp_conditional_advertisement_tc_9_3():
test_func = functools.partial(
non_exist_map_routes_not_present_rmap2_network, router3
)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = "TC93: non-exist-map routes not present, route-map filter and network - "
assert result is None, msg + failed
@@ -1275,7 +1275,7 @@ def test_bgp_conditional_advertisement_tc_9_4():
test_func = functools.partial(
non_exist_map_routes_not_present_rmap2_no_network, router3
)
- success, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=90, wait=1)
msg = "TC94: non-exist-map routes not present, route-map filter and no network - "
assert result is None, msg + failed
diff --git a/tests/topotests/bgp_conditional_advertisement_track_peer/test_bgp_conditional_advertisement_track_peer.py b/tests/topotests/bgp_conditional_advertisement_track_peer/test_bgp_conditional_advertisement_track_peer.py
index e76307291e..bb98e2fad0 100644
--- a/tests/topotests/bgp_conditional_advertisement_track_peer/test_bgp_conditional_advertisement_track_peer.py
+++ b/tests/topotests/bgp_conditional_advertisement_track_peer/test_bgp_conditional_advertisement_track_peer.py
@@ -51,7 +51,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_confederation_astype/test_bgp_confederation_astype.py b/tests/topotests/bgp_confederation_astype/test_bgp_confederation_astype.py
index 7bc0050109..44b1a2f704 100644
--- a/tests/topotests/bgp_confederation_astype/test_bgp_confederation_astype.py
+++ b/tests/topotests/bgp_confederation_astype/test_bgp_confederation_astype.py
@@ -35,7 +35,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_default_afi_safi/test_bgp-default-afi-safi.py b/tests/topotests/bgp_default_afi_safi/test_bgp-default-afi-safi.py
index 05e07486ae..48dddb4648 100644
--- a/tests/topotests/bgp_default_afi_safi/test_bgp-default-afi-safi.py
+++ b/tests/topotests/bgp_default_afi_safi/test_bgp-default-afi-safi.py
@@ -48,7 +48,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_default_originate_timer/test_bgp_default_originate_timer.py b/tests/topotests/bgp_default_originate_timer/test_bgp_default_originate_timer.py
index b2ba936fb1..c7c40c1bfb 100644
--- a/tests/topotests/bgp_default_originate_timer/test_bgp_default_originate_timer.py
+++ b/tests/topotests/bgp_default_originate_timer/test_bgp_default_originate_timer.py
@@ -50,7 +50,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_default_originate_withdraw/test_bgp_default_originate_withdraw.py b/tests/topotests/bgp_default_originate_withdraw/test_bgp_default_originate_withdraw.py
index e25f85af85..cd4acc9aa4 100644
--- a/tests/topotests/bgp_default_originate_withdraw/test_bgp_default_originate_withdraw.py
+++ b/tests/topotests/bgp_default_originate_withdraw/test_bgp_default_originate_withdraw.py
@@ -49,7 +49,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_default_route/test_bgp_default-originate.py b/tests/topotests/bgp_default_route/test_bgp_default-originate.py
index 333beb067c..e805d06a6a 100644
--- a/tests/topotests/bgp_default_route/test_bgp_default-originate.py
+++ b/tests/topotests/bgp_default_route/test_bgp_default-originate.py
@@ -40,7 +40,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -85,19 +85,19 @@ def test_bgp_default_originate_route_map():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_check_if_received)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert result is None, "No 0.0.0.0/0 at r2 from r1"
test_func = functools.partial(_bgp_check_if_originated)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert result is None, "No 0.0.0.0/0 from r1 to r2"
test_func = functools.partial(_bgp_route_is_valid, tgen.gears["r2"], "0.0.0.0/0")
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert result is None, "Failed to see 0.0.0.0/0 in r2"
test_func = functools.partial(_bgp_route_is_valid, tgen.gears["r2"], "0.0.0.0/1")
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert result is None, "Failed to see 0.0.0.0/1 in r2"
diff --git a/tests/topotests/bgp_default_route_route_map_match/test_bgp_default-originate_route-map_match.py b/tests/topotests/bgp_default_route_route_map_match/test_bgp_default-originate_route-map_match.py
index 9dcb5a1eef..d866b95f7b 100644
--- a/tests/topotests/bgp_default_route_route_map_match/test_bgp_default-originate_route-map_match.py
+++ b/tests/topotests/bgp_default_route_route_map_match/test_bgp_default-originate_route-map_match.py
@@ -40,7 +40,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -80,12 +80,12 @@ def test_bgp_default_originate_route_map():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_converge, router)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert result is None, 'Failed to see bgp convergence in "{}"'.format(router)
test_func = functools.partial(_bgp_default_route_is_valid, router)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert (
result is None
diff --git a/tests/topotests/bgp_default_route_route_map_match2/test_bgp_default-originate_route-map_match2.py b/tests/topotests/bgp_default_route_route_map_match2/test_bgp_default-originate_route-map_match2.py
index 965d348bd7..5a99878b88 100644
--- a/tests/topotests/bgp_default_route_route_map_match2/test_bgp_default-originate_route-map_match2.py
+++ b/tests/topotests/bgp_default_route_route_map_match2/test_bgp_default-originate_route-map_match2.py
@@ -43,7 +43,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -84,7 +84,7 @@ def test_bgp_default_originate_route_map():
step("Converge network")
test_func = functools.partial(_bgp_converge, router)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert result is None, "Failed to see bgp convergence at r2"
step("Withdraw 10.0.0.0/22 from R2")
@@ -94,7 +94,7 @@ def test_bgp_default_originate_route_map():
step("Check if we don't have 0.0.0.0/0 at R2")
test_func = functools.partial(_bgp_default_route_is_valid, router)
- success, result = topotest.run_and_expect(test_func, not None, count=30, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, not None, count=30, wait=0.5)
assert result is not None, "0.0.0.0/0 exists at r2"
step("Announce 10.0.0.0/22 from R2")
@@ -102,7 +102,7 @@ def test_bgp_default_originate_route_map():
step("Check if we have 0.0.0.0/0 at R2")
test_func = functools.partial(_bgp_default_route_is_valid, router)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert result is None, "0.0.0.0/0 does not exist at r2"
step("Withdraw 10.0.0.0/22 from R2 again")
@@ -112,7 +112,7 @@ def test_bgp_default_originate_route_map():
step("Check if we don't have 0.0.0.0/0 at R2 again")
test_func = functools.partial(_bgp_default_route_is_valid, router)
- success, result = topotest.run_and_expect(test_func, not None, count=30, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, not None, count=30, wait=0.5)
assert result is not None, "0.0.0.0/0 exists at r2"
diff --git a/tests/topotests/bgp_default_route_route_map_match_set/test_bgp_default-originate_route-map_match_set.py b/tests/topotests/bgp_default_route_route_map_match_set/test_bgp_default-originate_route-map_match_set.py
index f94620b2c9..3a374c6e9a 100644
--- a/tests/topotests/bgp_default_route_route_map_match_set/test_bgp_default-originate_route-map_match_set.py
+++ b/tests/topotests/bgp_default_route_route_map_match_set/test_bgp_default-originate_route-map_match_set.py
@@ -42,7 +42,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -90,12 +90,12 @@ def test_bgp_default_originate_route_map():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_converge, router)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert result is None, 'Failed to see bgp convergence in "{}"'.format(router)
test_func = functools.partial(_bgp_default_route_has_metric, router)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert (
result is None
diff --git a/tests/topotests/bgp_default_route_route_map_set/test_bgp_default-originate_route-map_set.py b/tests/topotests/bgp_default_route_route_map_set/test_bgp_default-originate_route-map_set.py
index e633b61d1b..ba278295a6 100644
--- a/tests/topotests/bgp_default_route_route_map_set/test_bgp_default-originate_route-map_set.py
+++ b/tests/topotests/bgp_default_route_route_map_set/test_bgp_default-originate_route-map_set.py
@@ -41,7 +41,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_disable_addpath_rx/test_disable_addpath_rx.py b/tests/topotests/bgp_disable_addpath_rx/test_disable_addpath_rx.py
index 70562ce31f..6978008740 100644
--- a/tests/topotests/bgp_disable_addpath_rx/test_disable_addpath_rx.py
+++ b/tests/topotests/bgp_disable_addpath_rx/test_disable_addpath_rx.py
@@ -46,7 +46,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -98,7 +98,7 @@ def test_bgp_disable_addpath_rx():
return topotest.json_cmp(output, expected)
test_func = functools.partial(check_bgp_advertised_routes, r2)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, "AddPath TX not working."
step("Check if AddPath RX is disabled on r1 and we receive only 2 paths.")
@@ -120,7 +120,7 @@ def test_bgp_disable_addpath_rx():
return topotest.json_cmp(output, expected)
test_func = functools.partial(check_bgp_disabled_addpath_rx, r1)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, "AddPath RX advertised, but should not."
diff --git a/tests/topotests/bgp_distance_change/test_bgp_distance_change.py b/tests/topotests/bgp_distance_change/test_bgp_distance_change.py
index 2ca50aa56e..87802511b5 100644
--- a/tests/topotests/bgp_distance_change/test_bgp_distance_change.py
+++ b/tests/topotests/bgp_distance_change/test_bgp_distance_change.py
@@ -51,7 +51,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -101,14 +101,14 @@ def test_bgp_maximum_prefix_invalid():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_converge, router)
- success, result = topotest.run_and_expect(test_func, None, count=15, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=15, wait=0.5)
assert result is None, 'Failed to see BGP convergence in "{}"'.format(router)
_bgp_distance_change(router)
test_func = functools.partial(_bgp_check_distance_change, router)
- success, result = topotest.run_and_expect(test_func, None, count=15, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=15, wait=0.5)
assert result is None, 'Failed to see applied BGP distance in RIB "{}"'.format(
router
diff --git a/tests/topotests/bgp_dont_capability_negotiate/test_bgp_dont_capability_negotiate.py b/tests/topotests/bgp_dont_capability_negotiate/test_bgp_dont_capability_negotiate.py
index 8269322215..28d6b56303 100644
--- a/tests/topotests/bgp_dont_capability_negotiate/test_bgp_dont_capability_negotiate.py
+++ b/tests/topotests/bgp_dont_capability_negotiate/test_bgp_dont_capability_negotiate.py
@@ -34,7 +34,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_duplicate_nexthop/r1/bgpd.conf b/tests/topotests/bgp_duplicate_nexthop/r1/bgpd.conf
new file mode 100644
index 0000000000..31f06dbb90
--- /dev/null
+++ b/tests/topotests/bgp_duplicate_nexthop/r1/bgpd.conf
@@ -0,0 +1,13 @@
+router bgp 64500
+ bgp router-id 192.0.2.1
+ no bgp ebgp-requires-policy
+ neighbor rrserver peer-group
+ neighbor rrserver remote-as 64500
+ neighbor rrserver update-source lo
+ neighbor rrserver timers connect 2
+ neighbor 192.0.2.3 peer-group rrserver
+ address-family ipv4 unicast
+ neighbor rrserver next-hop-self
+ neighbor rrserver activate
+ exit-address-family
+!
diff --git a/tests/topotests/bgp_duplicate_nexthop/r1/isisd.conf b/tests/topotests/bgp_duplicate_nexthop/r1/isisd.conf
new file mode 100644
index 0000000000..9660577f4e
--- /dev/null
+++ b/tests/topotests/bgp_duplicate_nexthop/r1/isisd.conf
@@ -0,0 +1,26 @@
+hostname r1
+interface lo
+ ip router isis 1
+ isis passive
+!
+interface r1-eth1
+ ip router isis 1
+ isis network point-to-point
+!
+interface r1-eth2
+ ip router isis 1
+ isis network point-to-point
+!
+interface r1-eth4
+ ip router isis 1
+ isis network point-to-point
+!
+router isis 1
+ net 49.0123.6452.0001.00
+ is-type level-2-only
+ mpls-te on
+ segment-routing on
+ segment-routing global-block 16000 17000
+ segment-routing node-msd 10
+ segment-routing prefix 192.0.2.1/32 index 1
+!
diff --git a/tests/topotests/bgp_duplicate_nexthop/r1/zebra.conf b/tests/topotests/bgp_duplicate_nexthop/r1/zebra.conf
new file mode 100644
index 0000000000..2e3549a574
--- /dev/null
+++ b/tests/topotests/bgp_duplicate_nexthop/r1/zebra.conf
@@ -0,0 +1,24 @@
+log stdout
+interface lo
+ ip address 192.0.2.1/32
+!
+interface r1-eth0
+ ip address 172.31.10.1/24
+!
+interface r1-eth1
+ ip address 172.31.0.1/24
+ mpls enable
+!
+interface r1-eth2
+ ip address 172.31.2.1/24
+ mpls enable
+!
+interface r1-eth3
+ ip address 172.31.11.1/24
+ mpls enable
+!
+interface r1-eth4
+ ip address 172.31.8.1/24
+ mpls enable
+!
+
diff --git a/tests/topotests/bgp_duplicate_nexthop/r3/bgpd.conf b/tests/topotests/bgp_duplicate_nexthop/r3/bgpd.conf
new file mode 100644
index 0000000000..2b03f51a23
--- /dev/null
+++ b/tests/topotests/bgp_duplicate_nexthop/r3/bgpd.conf
@@ -0,0 +1,16 @@
+router bgp 64500 view one
+ bgp router-id 192.0.2.3
+ neighbor rr peer-group
+ neighbor rr remote-as 64500
+ neighbor rr update-source lo
+ neighbor 192.0.2.1 peer-group rr
+ neighbor 192.0.2.5 peer-group rr
+ neighbor 192.0.2.6 peer-group rr
+ neighbor 192.0.2.8 peer-group rr
+ !
+ address-family ipv4 unicast
+ neighbor rr activate
+ neighbor rr route-reflector-client
+ neighbor rr addpath-tx-all-paths
+ exit-address-family
+!
diff --git a/tests/topotests/bgp_duplicate_nexthop/r3/isisd.conf b/tests/topotests/bgp_duplicate_nexthop/r3/isisd.conf
new file mode 100644
index 0000000000..ae6bddee92
--- /dev/null
+++ b/tests/topotests/bgp_duplicate_nexthop/r3/isisd.conf
@@ -0,0 +1,38 @@
+hostname r3
+interface lo
+ ip router isis 1
+ isis passive
+!
+interface r3-eth0
+ ip router isis 1
+ isis network point-to-point
+!
+interface r3-eth1
+ ip router isis 1
+ isis network point-to-point
+!
+interface r3-eth2
+ ip router isis 1
+ isis network point-to-point
+!
+interface r3-eth3
+ ip router isis 1
+ isis network point-to-point
+!
+interface r3-eth4
+ ip router isis 1
+ isis network point-to-point
+!
+interface r3-eth5
+ ip router isis 1
+ isis network point-to-point
+!
+router isis 1
+ net 49.0123.6452.0003.00
+ is-type level-2-only
+ mpls-te on
+ segment-routing on
+ segment-routing global-block 16000 17000
+ segment-routing node-msd 10
+ segment-routing prefix 192.0.2.3/32 index 3
+!
diff --git a/tests/topotests/bgp_duplicate_nexthop/r3/zebra.conf b/tests/topotests/bgp_duplicate_nexthop/r3/zebra.conf
new file mode 100644
index 0000000000..05b3769fb8
--- /dev/null
+++ b/tests/topotests/bgp_duplicate_nexthop/r3/zebra.conf
@@ -0,0 +1,16 @@
+log stdout
+interface lo
+ ip address 192.0.2.3/32
+!
+interface r3-eth0
+ ip address 172.31.0.3/24
+ mpls enable
+!
+interface r3-eth1
+ ip address 172.31.4.3/24
+ mpls enable
+!
+interface r3-eth2
+ ip address 172.31.5.3/24
+ mpls enable
+!
diff --git a/tests/topotests/bgp_duplicate_nexthop/r4/isisd.conf b/tests/topotests/bgp_duplicate_nexthop/r4/isisd.conf
new file mode 100644
index 0000000000..4d49d0de0a
--- /dev/null
+++ b/tests/topotests/bgp_duplicate_nexthop/r4/isisd.conf
@@ -0,0 +1,30 @@
+hostname r4
+interface lo
+ ip router isis 1
+ isis passive
+!
+interface r4-eth0
+ ip router isis 1
+ isis network point-to-point
+!
+interface r4-eth1
+ ip router isis 1
+ isis network point-to-point
+!
+interface r4-eth2
+ ip router isis 1
+ isis network point-to-point
+!
+interface r4-eth3
+ ip router isis 1
+ isis network point-to-point
+!
+router isis 1
+ net 49.0123.6452.0004.00
+ is-type level-2-only
+ mpls-te on
+ segment-routing on
+ segment-routing global-block 16000 17000
+ segment-routing node-msd 10
+ segment-routing prefix 192.0.2.4/32 index 4
+!
diff --git a/tests/topotests/bgp_duplicate_nexthop/r4/zebra.conf b/tests/topotests/bgp_duplicate_nexthop/r4/zebra.conf
new file mode 100644
index 0000000000..9ea1b7ec43
--- /dev/null
+++ b/tests/topotests/bgp_duplicate_nexthop/r4/zebra.conf
@@ -0,0 +1,20 @@
+log stdout
+interface lo
+ ip address 192.0.2.4/32
+!
+interface r4-eth0
+ ip address 172.31.2.4/24
+ mpls enable
+!
+interface r4-eth1
+ ip address 172.31.6.4/24
+ mpls enable
+!
+interface r4-eth2
+ ip address 172.31.7.4/24
+ mpls enable
+!
+interface r4-eth3
+ mpls enable
+!
+
diff --git a/tests/topotests/bgp_duplicate_nexthop/r5/bgpd.conf b/tests/topotests/bgp_duplicate_nexthop/r5/bgpd.conf
new file mode 100644
index 0000000000..272183b1ac
--- /dev/null
+++ b/tests/topotests/bgp_duplicate_nexthop/r5/bgpd.conf
@@ -0,0 +1,19 @@
+router bgp 64500
+ bgp router-id 192.0.2.5
+ no bgp ebgp-requires-policy
+ no bgp network import-check
+ neighbor rrserver peer-group
+ neighbor rrserver remote-as 64500
+ neighbor rrserver update-source lo
+ neighbor rrserver timers connect 2
+ neighbor 192.0.2.3 peer-group rrserver
+ address-family ipv4 unicast
+ network 192.0.2.9/32
+ network 192.0.2.8/32 route-map rmap
+ neighbor rrserver activate
+ neighbor rrserver addpath-tx-all-paths
+ exit-address-family
+!
+route-map rmap permit 1
+ set ip next-hop 192.0.2.9
+exit
diff --git a/tests/topotests/bgp_duplicate_nexthop/r5/isisd.conf b/tests/topotests/bgp_duplicate_nexthop/r5/isisd.conf
new file mode 100644
index 0000000000..46556d9a56
--- /dev/null
+++ b/tests/topotests/bgp_duplicate_nexthop/r5/isisd.conf
@@ -0,0 +1,26 @@
+hostname r5
+interface lo
+ ip router isis 1
+ isis passive
+!
+interface r5-eth1
+ ip router isis 1
+ isis network point-to-point
+!
+interface r5-eth2
+ ip router isis 1
+ isis network point-to-point
+!
+interface r5-eth3
+ ip router isis 1
+ isis network point-to-point
+!
+router isis 1
+ net 49.0123.6452.0005.00
+ is-type level-2-only
+ mpls-te on
+ segment-routing on
+ segment-routing global-block 16000 17000
+ segment-routing node-msd 10
+ segment-routing prefix 192.0.2.5/32 index 55
+!
diff --git a/tests/topotests/bgp_duplicate_nexthop/r5/zebra.conf b/tests/topotests/bgp_duplicate_nexthop/r5/zebra.conf
new file mode 100644
index 0000000000..6f326561e7
--- /dev/null
+++ b/tests/topotests/bgp_duplicate_nexthop/r5/zebra.conf
@@ -0,0 +1,19 @@
+log stdout
+mpls label dynamic-block 5000 5999
+interface lo
+ ip address 192.0.2.5/32
+!
+interface r5-eth0
+ ip address 172.31.12.5/24
+!
+interface r5-eth1
+ ip address 172.31.4.5/24
+ mpls enable
+!
+interface r5-eth2
+ ip address 172.31.7.5/24
+ mpls enable
+!
+interface r5-eth3
+ ip address 172.31.21.5/24
+!
diff --git a/tests/topotests/bgp_duplicate_nexthop/r6/bgpd.conf b/tests/topotests/bgp_duplicate_nexthop/r6/bgpd.conf
new file mode 100644
index 0000000000..68bd36eb8a
--- /dev/null
+++ b/tests/topotests/bgp_duplicate_nexthop/r6/bgpd.conf
@@ -0,0 +1,19 @@
+router bgp 64500
+ bgp router-id 192.0.2.6
+ no bgp ebgp-requires-policy
+ no bgp network import-check
+ neighbor rrserver peer-group
+ neighbor rrserver remote-as 64500
+ neighbor rrserver update-source lo
+ neighbor rrserver bfd
+ neighbor 192.0.2.3 peer-group rrserver
+ address-family ipv4 unicast
+ network 192.0.2.9/32
+ network 192.0.2.8/32 route-map rmap
+ neighbor rrserver activate
+ neighbor rrserver addpath-tx-all-paths
+ exit-address-family
+!
+route-map rmap permit 1
+ set ip next-hop 192.0.2.9
+exit
diff --git a/tests/topotests/bgp_duplicate_nexthop/r6/isisd.conf b/tests/topotests/bgp_duplicate_nexthop/r6/isisd.conf
new file mode 100644
index 0000000000..5126a64858
--- /dev/null
+++ b/tests/topotests/bgp_duplicate_nexthop/r6/isisd.conf
@@ -0,0 +1,22 @@
+hostname r6
+interface lo
+ ip router isis 1
+ isis passive
+!
+interface r6-eth1
+ ip router isis 1
+ isis network point-to-point
+!
+interface r6-eth2
+ ip router isis 1
+ isis network point-to-point
+!
+router isis 1
+ net 49.0123.6452.0006.00
+ is-type level-2-only
+ mpls-te on
+ segment-routing on
+ segment-routing global-block 16000 17000
+ segment-routing node-msd 10
+ segment-routing prefix 192.0.2.6/32 index 6
+!
diff --git a/tests/topotests/bgp_duplicate_nexthop/r6/zebra.conf b/tests/topotests/bgp_duplicate_nexthop/r6/zebra.conf
new file mode 100644
index 0000000000..cda62d7e87
--- /dev/null
+++ b/tests/topotests/bgp_duplicate_nexthop/r6/zebra.conf
@@ -0,0 +1,20 @@
+log stdout
+mpls label dynamic-block 6000 6999
+interface lo
+ ip address 192.0.2.6/32
+!
+interface r6-eth0
+ ip address 172.31.13.6/24
+!
+interface r6-eth1
+ ip address 172.31.5.6/24
+ mpls enable
+!
+interface r6-eth2
+ ip address 172.31.6.6/24
+ mpls enable
+!
+interface r6-eth3
+ ip address 172.31.22.6/24
+!
+
diff --git a/tests/topotests/bgp_duplicate_nexthop/test_bgp_duplicate_nexthop.py b/tests/topotests/bgp_duplicate_nexthop/test_bgp_duplicate_nexthop.py
new file mode 100644
index 0000000000..955881e6f9
--- /dev/null
+++ b/tests/topotests/bgp_duplicate_nexthop/test_bgp_duplicate_nexthop.py
@@ -0,0 +1,458 @@
+#!/usr/bin/env python
+# SPDX-License-Identifier: ISC
+
+#
+# test_bgp_duplicate_nexthop.py
+#
+# Copyright 2024 6WIND S.A.
+#
+
+"""
+ test_bgp_nhg_duplicate_nexthop.py:
+ Check that the FRR BGP daemon on r1 selects updates with same nexthops
+
+
++---+----+ +---+----+ +--------+
+| | | + | |
+| r1 +----------+ r3 +----------+ r5 +
+| | | rr + +-----+ |
++++-+----+ +--------+\ / +--------+
+ | \/
+ | /\
+ | +--------+/ \ +--------+
+ | | + +-----+ +
+ +---------------+ r4 +----------+ r6 +
+ | | | |
+ +--------+ +--------+
+"""
+
+import os
+import sys
+import json
+from functools import partial
+import pytest
+import functools
+
+# Save the Current Working Directory to find configuration files.
+CWD = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join(CWD, "../"))
+
+# pylint: disable=C0413
+# Import topogen and topotest helpers
+from lib import topotest
+from lib.common_check import ip_check_path_selection, iproute2_check_path_selection
+from lib.common_config import step
+from lib.topogen import Topogen, TopoRouter, get_topogen
+from lib.topolog import logger
+
+# Required to instantiate the topology builder class.
+
+
+pytestmark = [pytest.mark.bgpd]
+
+
+def build_topo(tgen):
+ "Build function"
+
+ # Create 7 PE routers.
+ tgen.add_router("r1")
+ tgen.add_router("r3")
+ tgen.add_router("r4")
+ tgen.add_router("r5")
+ tgen.add_router("r6")
+
+ # switch
+ switch = tgen.add_switch("s1")
+ switch.add_link(tgen.gears["r1"])
+
+ switch = tgen.add_switch("s4")
+ switch.add_link(tgen.gears["r5"])
+
+ switch = tgen.add_switch("s5")
+ switch.add_link(tgen.gears["r6"])
+
+ switch = tgen.add_switch("s6")
+ switch.add_link(tgen.gears["r1"])
+ switch.add_link(tgen.gears["r3"])
+
+ switch = tgen.add_switch("s7")
+ switch.add_link(tgen.gears["r1"])
+ switch.add_link(tgen.gears["r4"])
+
+ switch = tgen.add_switch("s8")
+ switch.add_link(tgen.gears["r3"])
+ switch.add_link(tgen.gears["r5"])
+
+ switch = tgen.add_switch("s9")
+ switch.add_link(tgen.gears["r3"])
+ switch.add_link(tgen.gears["r6"])
+
+ switch = tgen.add_switch("s10")
+ switch.add_link(tgen.gears["r4"])
+ switch.add_link(tgen.gears["r6"])
+
+ switch = tgen.add_switch("s11")
+ switch.add_link(tgen.gears["r4"])
+ switch.add_link(tgen.gears["r5"])
+
+ switch = tgen.add_switch("s12")
+ switch.add_link(tgen.gears["r5"])
+
+ switch = tgen.add_switch("s13")
+ switch.add_link(tgen.gears["r6"])
+
+ switch = tgen.add_switch("s14")
+ switch.add_link(tgen.gears["r1"])
+
+
+def setup_module(mod):
+ "Sets up the pytest environment"
+ tgen = Topogen(build_topo, mod.__name__)
+ tgen.start_topology()
+
+ router_list = tgen.routers()
+
+ for rname, router in router_list.items():
+ router.load_config(
+ TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
+ )
+ router.load_config(
+ TopoRouter.RD_ISIS, os.path.join(CWD, "{}/isisd.conf".format(rname))
+ )
+ if rname in ("r1", "r3", "r5", "r6"):
+ router.load_config(
+ TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname))
+ )
+
+ # Initialize all routers.
+ tgen.start_router()
+
+
+def teardown_module(_mod):
+ "Teardown the pytest environment"
+ tgen = get_topogen()
+
+ tgen.stop_topology()
+
+
+def check_ipv4_prefix_with_multiple_nexthops(prefix, multipath=True):
+ tgen = get_topogen()
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ logger.info(
+ f"Check that {prefix} unicast entry is installed with paths for r5 and r6"
+ )
+
+ r5_nh = [
+ {
+ "ip": "192.0.2.5",
+ "active": True,
+ "recursive": True,
+ },
+ {
+ "ip": "172.31.0.3",
+ "interfaceName": "r1-eth1",
+ "active": True,
+ "labels": [
+ 16055,
+ ],
+ },
+ {
+ "ip": "172.31.2.4",
+ "interfaceName": "r1-eth2",
+ "active": True,
+ "labels": [
+ 16055,
+ ],
+ },
+ ]
+
+ r6_nh = [
+ {
+ "ip": "192.0.2.6",
+ "active": True,
+ "recursive": True,
+ },
+ {
+ "ip": "172.31.0.3",
+ "interfaceName": "r1-eth1",
+ "active": True,
+ "labels": [
+ 16006,
+ ],
+ },
+ {
+ "ip": "172.31.2.4",
+ "interfaceName": "r1-eth2",
+ "active": True,
+ "labels": [
+ 16006,
+ ],
+ },
+ ]
+
+ expected = {
+ prefix: [
+ {
+ "prefix": prefix,
+ "protocol": "bgp",
+ "metric": 0,
+ "table": 254,
+ "nexthops": [],
+ }
+ ]
+ }
+ for nh in r5_nh:
+ expected[prefix][0]["nexthops"].append(nh)
+ if multipath:
+ for nh in r6_nh:
+ expected[prefix][0]["nexthops"].append(nh)
+
+ test_func = functools.partial(
+ ip_check_path_selection, tgen.gears["r1"], prefix, expected
+ )
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ assert (
+ result is None
+ ), f"Failed to check that {prefix} uses the IGP label 16055 and 16006"
+
+
+def get_nh_formatted(nexthop, fib=True, duplicate=False):
+ nh = dict(nexthop)
+ if duplicate:
+ nh.update({"duplicate": True})
+ if fib:
+ nh.update({"fib": True})
+ return nh
+
+
+def check_ipv4_prefix_recursive_with_multiple_nexthops(
+ prefix, recursive_nexthop, multipath=True
+):
+ tgen = get_topogen()
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+ logger.info(
+ f"Check that {prefix} unicast entry is correctly recursive via {recursive_nexthop} with paths for r5 and r6"
+ )
+
+ r5_nh = [
+ {
+ "ip": "172.31.0.3",
+ "interfaceName": "r1-eth1",
+ "active": True,
+ "labels": [
+ 16055,
+ ],
+ },
+ {
+ "ip": "172.31.2.4",
+ "interfaceName": "r1-eth2",
+ "active": True,
+ "labels": [
+ 16055,
+ ],
+ },
+ ]
+
+ r6_nh = [
+ {
+ "ip": "172.31.0.3",
+ "interfaceName": "r1-eth1",
+ "active": True,
+ "labels": [
+ 16006,
+ ],
+ },
+ {
+ "ip": "172.31.2.4",
+ "interfaceName": "r1-eth2",
+ "active": True,
+ "labels": [
+ 16006,
+ ],
+ },
+ ]
+
+ expected = {
+ prefix: [
+ {
+ "prefix": prefix,
+ "protocol": "bgp",
+ "metric": 0,
+ "table": 254,
+ "nexthops": [],
+ }
+ ]
+ }
+
+ recursive_nh = [
+ {
+ "ip": recursive_nexthop,
+ "active": True,
+ "recursive": True,
+ },
+ ]
+ for nh in recursive_nh:
+ expected[prefix][0]["nexthops"].append(get_nh_formatted(nh, fib=False))
+
+ for nh in r5_nh:
+ expected[prefix][0]["nexthops"].append(get_nh_formatted(nh))
+
+ if multipath:
+ for nh in r6_nh:
+ expected[prefix][0]["nexthops"].append(get_nh_formatted(nh))
+
+ for nh in recursive_nh:
+ expected[prefix][0]["nexthops"].append(
+ get_nh_formatted(nh, fib=False, duplicate=True)
+ )
+
+ for nh in r5_nh:
+ expected[prefix][0]["nexthops"].append(
+ get_nh_formatted(nh, fib=False, duplicate=True)
+ )
+
+ for nh in r6_nh:
+ expected[prefix][0]["nexthops"].append(
+ get_nh_formatted(nh, fib=False, duplicate=True)
+ )
+
+ test_func = functools.partial(
+ ip_check_path_selection, tgen.gears["r1"], prefix, expected
+ )
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ assert (
+ result is None
+ ), f"Failed to check that {prefix} is correctly recursive via {recursive_nexthop}"
+
+
+def check_ipv4_prefix_with_multiple_nexthops_linux(prefix):
+ tgen = get_topogen()
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ step(
+ f"Check that {prefix} unicast entry is installed with paths for r5 and r6 on Linux"
+ )
+
+ r5_nh = [
+ {
+ "encap": "mpls",
+ "dst": "16055",
+ "gateway": "172.31.0.3",
+ "dev": "r1-eth1",
+ },
+ {
+ "encap": "mpls",
+ "dst": "16055",
+ "gateway": "172.31.2.4",
+ "dev": "r1-eth2",
+ },
+ ]
+
+ r6_nh = [
+ {
+ "encap": "mpls",
+ "dst": "16006",
+ "gateway": "172.31.0.3",
+ "dev": "r1-eth1",
+ },
+ {
+ "encap": "mpls",
+ "dst": "16006",
+ "gateway": "172.31.2.4",
+ "dev": "r1-eth2",
+ },
+ ]
+
+ expected = [
+ {
+ "dst": prefix,
+ "protocol": "bgp",
+ "metric": 20,
+ "nexthops": [],
+ }
+ ]
+
+ # only one path
+ for nh in r5_nh:
+ expected[0]["nexthops"].append(nh)
+ for nh in r6_nh:
+ expected[0]["nexthops"].append(nh)
+
+ test_func = functools.partial(
+ iproute2_check_path_selection, tgen.routers()["r1"], prefix, expected
+ )
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ assert (
+ result is None
+ ), f"Failed to check that {prefix} unicast entry is installed with paths for r5 and r6 on Linux"
+
+
+def test_bgp_ipv4_convergence():
+ """
+ Check that R1 has received the 192.0.2.9/32 prefix from R5, and R6
+ """
+ tgen = get_topogen()
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ logger.info("Ensure that the 192.0.2.9/32 route is available")
+ check_ipv4_prefix_with_multiple_nexthops("192.0.2.9/32")
+
+ check_ipv4_prefix_with_multiple_nexthops_linux("192.0.2.9")
+
+
+def test_bgp_ipv4_recursive_routes():
+ """
+ Check that R1 has received the recursive routes, and duplicate nexthops are in zebra, but are not installed
+ """
+ tgen = get_topogen()
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ check_ipv4_prefix_recursive_with_multiple_nexthops("192.0.2.8/32", "192.0.2.9")
+
+ check_ipv4_prefix_with_multiple_nexthops_linux("192.0.2.8")
+
+
+def test_bgp_ipv4_recursive_routes_when_no_mpath():
+ """
+ Unconfigure multipath ibgp
+ Check that duplicate nexthops are not in zebra
+ """
+ tgen = get_topogen()
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ tgen.gears["r1"].vtysh_cmd(
+ """
+ configure terminal
+ router bgp
+ address family ipv4 unicast
+ maximum-paths ibgp 1
+ """,
+ isjson=False,
+ )
+ tgen.gears["r1"].vtysh_cmd("clear bgp ipv4 *")
+ check_ipv4_prefix_with_multiple_nexthops("192.0.2.9/32", multipath=False)
+
+ check_ipv4_prefix_recursive_with_multiple_nexthops(
+ "192.0.2.8/32", "192.0.2.9", multipath=False
+ )
+
+
+def test_memory_leak():
+ "Run the memory leak test and report results."
+ tgen = get_topogen()
+ if not tgen.is_memleak_enabled():
+ pytest.skip("Memory leak test/report is disabled")
+
+ tgen.report_memory_leaks()
+
+
+if __name__ == "__main__":
+ args = ["-s"] + sys.argv[1:]
+ sys.exit(pytest.main(args))
diff --git a/tests/topotests/bgp_ebgp_common_subnet_nexthop_unchanged/test_bgp-ebgp-common-subnet-nexthop-unchanged.py b/tests/topotests/bgp_ebgp_common_subnet_nexthop_unchanged/test_bgp-ebgp-common-subnet-nexthop-unchanged.py
index d9ccd6979c..a4ac249cb7 100644
--- a/tests/topotests/bgp_ebgp_common_subnet_nexthop_unchanged/test_bgp-ebgp-common-subnet-nexthop-unchanged.py
+++ b/tests/topotests/bgp_ebgp_common_subnet_nexthop_unchanged/test_bgp-ebgp-common-subnet-nexthop-unchanged.py
@@ -52,7 +52,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -90,7 +90,7 @@ def test_bgp_ebgp_common_subnet_nh_unchanged():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_converge, r3)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, 'Failed bgp convergence in "{}"'.format(r3)
@@ -100,7 +100,7 @@ def test_bgp_ebgp_common_subnet_nh_unchanged():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_nh_unchanged, r2)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, 'Wrong next-hop in "{}"'.format(r2)
diff --git a/tests/topotests/bgp_ebgp_requires_policy/test_bgp_ebgp_requires_policy.py b/tests/topotests/bgp_ebgp_requires_policy/test_bgp_ebgp_requires_policy.py
index 6e3b2859c4..f7c0f70445 100644
--- a/tests/topotests/bgp_ebgp_requires_policy/test_bgp_ebgp_requires_policy.py
+++ b/tests/topotests/bgp_ebgp_requires_policy/test_bgp_ebgp_requires_policy.py
@@ -71,7 +71,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -125,31 +125,31 @@ def test_ebgp_requires_policy():
# Scenario 1.
logger.info("Scenario 1: r2 receives 192.168.255.1/32 from r1")
test_func = functools.partial(_bgp_converge, "r2")
- success, result = topotest.run_and_expect(test_func, None, count=120, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=120, wait=0.5)
assert success is True, "Failed bgp convergence (r2)"
test_func = functools.partial(_bgp_has_routes, "r2")
- success, result = topotest.run_and_expect(test_func, None, count=120, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=120, wait=0.5)
assert success is True, "r2 does not receive 192.168.255.1/32"
# Scenario 2.
logger.info("Scenario 2: r3 must not send 192.168.255.1/32 to r4")
test_func = functools.partial(_bgp_converge, "r4")
- success, result = topotest.run_and_expect(test_func, None, count=120, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=120, wait=0.5)
assert success is True, "Failed bgp convergence (r4)"
test_func = functools.partial(_bgp_advertised_routes, "r3")
- success, result = topotest.run_and_expect(test_func, None, count=120, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=120, wait=0.5)
assert success is True, "r3 announced 192.168.255.1/32 to r4"
# Scenario 3.
logger.info("Scenario 3: r6 receives 192.168.255.1/32 from r5 (iBGP)")
test_func = functools.partial(_bgp_converge, "r6")
- success, result = topotest.run_and_expect(test_func, None, count=120, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=120, wait=0.5)
assert success is True, "Failed bgp convergence (r6)"
test_func = functools.partial(_bgp_has_routes, "r6")
- success, result = topotest.run_and_expect(test_func, None, count=120, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=120, wait=0.5)
assert success is True, "r6 does not receive 192.168.255.1/32"
diff --git a/tests/topotests/bgp_extcomm_list_delete/test_bgp_extcomm-list_delete.py b/tests/topotests/bgp_extcomm_list_delete/test_bgp_extcomm-list_delete.py
index a5e5bdcee9..5f6eb17261 100644
--- a/tests/topotests/bgp_extcomm_list_delete/test_bgp_extcomm-list_delete.py
+++ b/tests/topotests/bgp_extcomm_list_delete/test_bgp_extcomm-list_delete.py
@@ -47,7 +47,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_extended_optional_parameters_length/test_bgp_extended_optional_parameters_length.py b/tests/topotests/bgp_extended_optional_parameters_length/test_bgp_extended_optional_parameters_length.py
index a5db20e474..c67bc91f63 100644
--- a/tests/topotests/bgp_extended_optional_parameters_length/test_bgp_extended_optional_parameters_length.py
+++ b/tests/topotests/bgp_extended_optional_parameters_length/test_bgp_extended_optional_parameters_length.py
@@ -34,7 +34,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py b/tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py
index 2ffcb723ec..16459a25a3 100644
--- a/tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py
+++ b/tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py
@@ -50,7 +50,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_gshut/test_bgp_gshut.py b/tests/topotests/bgp_gshut/test_bgp_gshut.py
index 61a0fe63c1..cfe63d20ba 100644
--- a/tests/topotests/bgp_gshut/test_bgp_gshut.py
+++ b/tests/topotests/bgp_gshut/test_bgp_gshut.py
@@ -108,7 +108,7 @@ def setup_module(mod):
r2.run("ip link set r2-eth3 master vrf1")
# Load FRR config and initialize all routers
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_ipv4_class_e_peer/test_bgp_ipv4_class_e_peer.py b/tests/topotests/bgp_ipv4_class_e_peer/test_bgp_ipv4_class_e_peer.py
index c7cb213de5..66eeeb468d 100644
--- a/tests/topotests/bgp_ipv4_class_e_peer/test_bgp_ipv4_class_e_peer.py
+++ b/tests/topotests/bgp_ipv4_class_e_peer/test_bgp_ipv4_class_e_peer.py
@@ -45,7 +45,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_ipv6_ll_peering/test_bgp_ipv6_ll_peering.py b/tests/topotests/bgp_ipv6_ll_peering/test_bgp_ipv6_ll_peering.py
index ea974b5302..aaa68ea340 100644
--- a/tests/topotests/bgp_ipv6_ll_peering/test_bgp_ipv6_ll_peering.py
+++ b/tests/topotests/bgp_ipv6_ll_peering/test_bgp_ipv6_ll_peering.py
@@ -41,7 +41,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_l3vpn_label_export/test_bgp_l3vpn_label_export.py b/tests/topotests/bgp_l3vpn_label_export/test_bgp_l3vpn_label_export.py
index 7c23a3e899..84a9c8b723 100644
--- a/tests/topotests/bgp_l3vpn_label_export/test_bgp_l3vpn_label_export.py
+++ b/tests/topotests/bgp_l3vpn_label_export/test_bgp_l3vpn_label_export.py
@@ -56,7 +56,7 @@ def setup_module(mod):
)
tgen.gears["r{}".format(rtr)].run("sysctl -w net.mpls.conf.vrf1.input=1")
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_labeled_unicast_addpath/test_bgp_labeled_unicast_addpath.py b/tests/topotests/bgp_labeled_unicast_addpath/test_bgp_labeled_unicast_addpath.py
index f4bb487e40..25fd0dbb71 100644
--- a/tests/topotests/bgp_labeled_unicast_addpath/test_bgp_labeled_unicast_addpath.py
+++ b/tests/topotests/bgp_labeled_unicast_addpath/test_bgp_labeled_unicast_addpath.py
@@ -57,7 +57,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_labeled_unicast_default_originate/test_bgp_labeled_unicast_default_originate.py b/tests/topotests/bgp_labeled_unicast_default_originate/test_bgp_labeled_unicast_default_originate.py
index 34c23d9b6f..d1d384182c 100644
--- a/tests/topotests/bgp_labeled_unicast_default_originate/test_bgp_labeled_unicast_default_originate.py
+++ b/tests/topotests/bgp_labeled_unicast_default_originate/test_bgp_labeled_unicast_default_originate.py
@@ -42,7 +42,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_large_comm_list_match/test_bgp_large_comm_list_match.py b/tests/topotests/bgp_large_comm_list_match/test_bgp_large_comm_list_match.py
index 7023e3a503..49681c6a69 100644
--- a/tests/topotests/bgp_large_comm_list_match/test_bgp_large_comm_list_match.py
+++ b/tests/topotests/bgp_large_comm_list_match/test_bgp_large_comm_list_match.py
@@ -61,7 +61,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_llgr/test_bgp_llgr.py b/tests/topotests/bgp_llgr/test_bgp_llgr.py
index d7897cfcb9..2a3753e26c 100644
--- a/tests/topotests/bgp_llgr/test_bgp_llgr.py
+++ b/tests/topotests/bgp_llgr/test_bgp_llgr.py
@@ -65,7 +65,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_local_as/test_bgp_local_as.py b/tests/topotests/bgp_local_as/test_bgp_local_as.py
index 9e5f146b47..e61bb0d155 100644
--- a/tests/topotests/bgp_local_as/test_bgp_local_as.py
+++ b/tests/topotests/bgp_local_as/test_bgp_local_as.py
@@ -46,7 +46,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_local_as_dotplus_private_remove/test_bgp_local_as_dotplus_private_remove.py b/tests/topotests/bgp_local_as_dotplus_private_remove/test_bgp_local_as_dotplus_private_remove.py
index 930fd791b0..c58322a4c0 100644
--- a/tests/topotests/bgp_local_as_dotplus_private_remove/test_bgp_local_as_dotplus_private_remove.py
+++ b/tests/topotests/bgp_local_as_dotplus_private_remove/test_bgp_local_as_dotplus_private_remove.py
@@ -63,7 +63,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_local_as_private_remove/test_bgp_local_as_private_remove.py b/tests/topotests/bgp_local_as_private_remove/test_bgp_local_as_private_remove.py
index 9d22a799a6..23eb80f316 100644
--- a/tests/topotests/bgp_local_as_private_remove/test_bgp_local_as_private_remove.py
+++ b/tests/topotests/bgp_local_as_private_remove/test_bgp_local_as_private_remove.py
@@ -50,7 +50,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_lu_explicitnull/test_bgp_lu_explicitnull.py b/tests/topotests/bgp_lu_explicitnull/test_bgp_lu_explicitnull.py
index 0656e1ed41..18ffc6a17d 100644
--- a/tests/topotests/bgp_lu_explicitnull/test_bgp_lu_explicitnull.py
+++ b/tests/topotests/bgp_lu_explicitnull/test_bgp_lu_explicitnull.py
@@ -142,7 +142,7 @@ def test_converge_bgplu():
"192.168.2.2/32",
"0",
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "r1, prefix 192.168.2.2/32 from r2 not present"
# Check r2 gets prefix 192.168.2.1/32
@@ -153,7 +153,7 @@ def test_converge_bgplu():
"192.168.2.1/32",
"0",
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "r2, prefix 192.168.2.1/32 from r1 not present"
@@ -178,7 +178,7 @@ def test_traffic_connectivity():
tgen = get_topogen()
func = functools.partial(_check_ping, "r1", "192.168.2.2", "192.168.2.1")
# tgen.mininet_cli()
- success, result = topotest.run_and_expect(func, None, count=10, wait=0.5)
+ _, result = topotest.run_and_expect(func, None, count=10, wait=0.5)
assert result is None, "r1, ping to 192.168.2.2 from 192.168.2.1 fails"
diff --git a/tests/topotests/bgp_max_med_on_startup/test_bgp_max_med_on_startup.py b/tests/topotests/bgp_max_med_on_startup/test_bgp_max_med_on_startup.py
index a9810ba264..545d7bd245 100644
--- a/tests/topotests/bgp_max_med_on_startup/test_bgp_max_med_on_startup.py
+++ b/tests/topotests/bgp_max_med_on_startup/test_bgp_max_med_on_startup.py
@@ -43,7 +43,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -82,17 +82,17 @@ def test_bgp_max_med_on_startup():
# Check session is established
test_func = functools.partial(_bgp_converge, router2)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert result is None, "Failed bgp convergence on r2"
# Check metric has value of max-med
test_func = functools.partial(_bgp_has_routes, router2, 777)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert result is None, "r2 does not receive routes with metric 777"
# Check that when the max-med timer expires, metric is updated
test_func = functools.partial(_bgp_has_routes, router2, 0)
- success, result = topotest.run_and_expect(test_func, None, count=16, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=16, wait=0.5)
assert result is None, "r2 does not receive routes with metric 0"
diff --git a/tests/topotests/bgp_maximum_prefix_invalid_update/test_bgp_maximum_prefix_invalid_update.py b/tests/topotests/bgp_maximum_prefix_invalid_update/test_bgp_maximum_prefix_invalid_update.py
index c6bdbc3c1c..5edc0b55ff 100644
--- a/tests/topotests/bgp_maximum_prefix_invalid_update/test_bgp_maximum_prefix_invalid_update.py
+++ b/tests/topotests/bgp_maximum_prefix_invalid_update/test_bgp_maximum_prefix_invalid_update.py
@@ -50,7 +50,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_maximum_prefix_out/test_bgp_maximum_prefix_out.py b/tests/topotests/bgp_maximum_prefix_out/test_bgp_maximum_prefix_out.py
index 0b346f63d5..aad5f36480 100644
--- a/tests/topotests/bgp_maximum_prefix_out/test_bgp_maximum_prefix_out.py
+++ b/tests/topotests/bgp_maximum_prefix_out/test_bgp_maximum_prefix_out.py
@@ -45,7 +45,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -177,7 +177,7 @@ def test_bgp_maximum_prefix_out():
router1.vtysh_cmd(cmd)
test_func = functools.partial(_bgp_converge, router2, exp_prfxs)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert result is None, 'Failed bgp convergence in "{}"'.format(router2)
diff --git a/tests/topotests/bgp_minimum_holdtime/test_bgp_minimum_holdtime.py b/tests/topotests/bgp_minimum_holdtime/test_bgp_minimum_holdtime.py
index 9f4d968277..c9ff2ffc7e 100755
--- a/tests/topotests/bgp_minimum_holdtime/test_bgp_minimum_holdtime.py
+++ b/tests/topotests/bgp_minimum_holdtime/test_bgp_minimum_holdtime.py
@@ -40,7 +40,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -76,7 +76,7 @@ def test_bgp_minimum_holdtime():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_neighbor_check_if_notification_sent)
- success, result = topotest.run_and_expect(test_func, None, count=40, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=40, wait=0.5)
assert result is None, "Failed to send notification message\n"
diff --git a/tests/topotests/bgp_node_target_extcommunities/test_bgp_node_target_extcommunities.py b/tests/topotests/bgp_node_target_extcommunities/test_bgp_node_target_extcommunities.py
index 23e820b4fc..b53673ad0f 100644
--- a/tests/topotests/bgp_node_target_extcommunities/test_bgp_node_target_extcommunities.py
+++ b/tests/topotests/bgp_node_target_extcommunities/test_bgp_node_target_extcommunities.py
@@ -46,7 +46,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_frr_config(os.path.join(CWD, "{}/frr.conf".format(rname)))
tgen.start_router()
diff --git a/tests/topotests/bgp_orf/test_bgp_orf.py b/tests/topotests/bgp_orf/test_bgp_orf.py
index 47c0556884..bc6a85b4b9 100644
--- a/tests/topotests/bgp_orf/test_bgp_orf.py
+++ b/tests/topotests/bgp_orf/test_bgp_orf.py
@@ -37,7 +37,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_path_selection/test_bgp_path_selection.py b/tests/topotests/bgp_path_selection/test_bgp_path_selection.py
index 30083b4de2..d486a87e9c 100644
--- a/tests/topotests/bgp_path_selection/test_bgp_path_selection.py
+++ b/tests/topotests/bgp_path_selection/test_bgp_path_selection.py
@@ -57,7 +57,7 @@ def setup_module(mod):
tgen.gears["r2"].cmd("ip address add dev vrf1 192.0.2.8/32")
tgen.gears["r3"].cmd("ip address add dev vrf1 192.0.2.8/32")
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_peer_graceful_shutdown/test_bgp_peer_graceful_shutdown.py b/tests/topotests/bgp_peer_graceful_shutdown/test_bgp_peer_graceful_shutdown.py
index 9269826233..c6ee9aa73c 100644
--- a/tests/topotests/bgp_peer_graceful_shutdown/test_bgp_peer_graceful_shutdown.py
+++ b/tests/topotests/bgp_peer_graceful_shutdown/test_bgp_peer_graceful_shutdown.py
@@ -34,7 +34,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_peer_group/test_bgp_peer-group.py b/tests/topotests/bgp_peer_group/test_bgp_peer-group.py
index 5cbcd19be9..7d476b0538 100644
--- a/tests/topotests/bgp_peer_group/test_bgp_peer-group.py
+++ b/tests/topotests/bgp_peer_group/test_bgp_peer-group.py
@@ -47,7 +47,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_prefix_list_any/test_bgp_prefix_list_any.py b/tests/topotests/bgp_prefix_list_any/test_bgp_prefix_list_any.py
index 5d6440ce6a..1871d3efc8 100644
--- a/tests/topotests/bgp_prefix_list_any/test_bgp_prefix_list_any.py
+++ b/tests/topotests/bgp_prefix_list_any/test_bgp_prefix_list_any.py
@@ -33,7 +33,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_prefix_sid/test_bgp_prefix_sid.py b/tests/topotests/bgp_prefix_sid/test_bgp_prefix_sid.py
index 1e6e731a18..fca60e8cea 100644
--- a/tests/topotests/bgp_prefix_sid/test_bgp_prefix_sid.py
+++ b/tests/topotests/bgp_prefix_sid/test_bgp_prefix_sid.py
@@ -93,11 +93,11 @@ def test_r1_receive_and_advertise_prefix_sid_type1():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_check_type1_r1, router, "3.0.0.1/32", 800001, 1)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert result is None, 'Failed _check_type1_r1 in "{}"'.format(router)
test_func = functools.partial(_check_type1_r1, router, "3.0.0.2/32", 800002, 2)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert result is None, 'Failed _check_type1_r1 in "{}"'.format(router)
@@ -160,11 +160,11 @@ def test_peer2_receive_prefix_sid_type1():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_check_type1_peer2, "3.0.0.1/32", label=8001)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert result is None, 'Failed _check_type1_peer2 in "{}"'.format("peer2")
test_func = functools.partial(_check_type1_peer2, "3.0.0.2/32", label=8002)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert result is None, 'Failed _check_type1_peer2 in "{}"'.format("peer2")
diff --git a/tests/topotests/bgp_reject_as_sets/test_bgp_reject_as_sets.py b/tests/topotests/bgp_reject_as_sets/test_bgp_reject_as_sets.py
index 97366ebd53..b9d8ce6819 100644
--- a/tests/topotests/bgp_reject_as_sets/test_bgp_reject_as_sets.py
+++ b/tests/topotests/bgp_reject_as_sets/test_bgp_reject_as_sets.py
@@ -56,7 +56,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -114,19 +114,19 @@ def test_bgp_reject_as_sets():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_converge, router)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, 'Failed bgp convergence in "{}"'.format(router)
test_func = functools.partial(
_bgp_has_aggregated_route_with_stripped_as_set, router
)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, 'Failed to see an aggregated route in "{}"'.format(router)
test_func = functools.partial(_bgp_announce_route_without_as_sets, router)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert (
result is None
diff --git a/tests/topotests/bgp_remove_private_as/test_bgp_remove_private_as.py b/tests/topotests/bgp_remove_private_as/test_bgp_remove_private_as.py
index e48f81c53d..2d8864c34a 100644
--- a/tests/topotests/bgp_remove_private_as/test_bgp_remove_private_as.py
+++ b/tests/topotests/bgp_remove_private_as/test_bgp_remove_private_as.py
@@ -109,7 +109,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, f"{rname}/zebra.conf")
)
diff --git a/tests/topotests/bgp_remove_private_as_route_map/test_bgp_remove_private_as_route_map.py b/tests/topotests/bgp_remove_private_as_route_map/test_bgp_remove_private_as_route_map.py
index d9402f2743..e3e4567aeb 100644
--- a/tests/topotests/bgp_remove_private_as_route_map/test_bgp_remove_private_as_route_map.py
+++ b/tests/topotests/bgp_remove_private_as_route_map/test_bgp_remove_private_as_route_map.py
@@ -41,7 +41,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_frr_config(os.path.join(CWD, "{}/frr.conf".format(rname)))
tgen.start_router()
diff --git a/tests/topotests/bgp_rmap_extcommunity_none/test_bgp_rmap_extcommunity_none.py b/tests/topotests/bgp_rmap_extcommunity_none/test_bgp_rmap_extcommunity_none.py
index ef7c94bbab..2e5592e2ab 100644
--- a/tests/topotests/bgp_rmap_extcommunity_none/test_bgp_rmap_extcommunity_none.py
+++ b/tests/topotests/bgp_rmap_extcommunity_none/test_bgp_rmap_extcommunity_none.py
@@ -43,7 +43,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -86,7 +86,7 @@ def test_bgp_extcommunity_none():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_converge, router)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, "BGP Converge failed"
def _bgp_extcommunity_strip(router):
@@ -111,7 +111,7 @@ def test_bgp_extcommunity_none():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_extcommunity_strip, router)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, "Failed to strip incoming extended communities from r2"
diff --git a/tests/topotests/bgp_roles_capability/test_bgp_roles_capability.py b/tests/topotests/bgp_roles_capability/test_bgp_roles_capability.py
index 52fda695c3..29ff1065fd 100644
--- a/tests/topotests/bgp_roles_capability/test_bgp_roles_capability.py
+++ b/tests/topotests/bgp_roles_capability/test_bgp_roles_capability.py
@@ -82,7 +82,7 @@ def test_correct_pair(tgen):
check_r2_established = functools.partial(
check_session_established, router, neighbor_ip
)
- success, result = topotest.run_and_expect(
+ success, _ = topotest.run_and_expect(
check_r2_established, True, count=20, wait=3
)
assert success, "Session with r2 is not Established"
@@ -100,7 +100,7 @@ def test_role_pair_mismatch(tgen):
router = tgen.gears["r3"]
neighbor_ip = "192.168.3.1"
check_r3_mismatch = functools.partial(check_role_mismatch, router, neighbor_ip)
- success, result = topotest.run_and_expect(check_r3_mismatch, True, count=20, wait=3)
+ success, _ = topotest.run_and_expect(check_r3_mismatch, True, count=20, wait=3)
assert success, "Session between r1 and r3 was not correctly closed"
@@ -111,7 +111,7 @@ def test_single_role_advertising(tgen):
check_r4_established = functools.partial(
check_session_established, router, neighbor_ip
)
- success, result = topotest.run_and_expect(
+ success, _ = topotest.run_and_expect(
check_r4_established, True, count=20, wait=3
)
assert success, "Session with r4 is not Established"
@@ -129,7 +129,7 @@ def test_single_role_receiving(tgen):
check_r1_established = functools.partial(
check_session_established, router, neighbor_ip
)
- success, result = topotest.run_and_expect(
+ success, _ = topotest.run_and_expect(
check_r1_established, True, count=20, wait=3
)
assert success, "Session with r1 is not Established"
@@ -145,7 +145,7 @@ def test_role_strict_mode(tgen):
router = tgen.gears["r5"]
neighbor_ip = "192.168.5.1"
check_r5_mismatch = functools.partial(check_role_mismatch, router, neighbor_ip)
- success, result = topotest.run_and_expect(check_r5_mismatch, True, count=20, wait=3)
+ success, _ = topotest.run_and_expect(check_r5_mismatch, True, count=20, wait=3)
assert success, "Session between r1 and r5 was not correctly closed"
diff --git a/tests/topotests/bgp_roles_filtering/test_bgp_roles_filtering.py b/tests/topotests/bgp_roles_filtering/test_bgp_roles_filtering.py
index b3715863b5..a43518bc8a 100644
--- a/tests/topotests/bgp_roles_filtering/test_bgp_roles_filtering.py
+++ b/tests/topotests/bgp_roles_filtering/test_bgp_roles_filtering.py
@@ -69,7 +69,7 @@ def test_r10_routes(tgen):
]
return output == expected
- success, result = topotest.run_and_expect(
+ success, _ = topotest.run_and_expect(
_routes_half_converged, True, count=20, wait=3
)
assert success, "Routes did not converged"
diff --git a/tests/topotests/bgp_route_map_delay_timer/test_bgp_route_map_delay_timer.py b/tests/topotests/bgp_route_map_delay_timer/test_bgp_route_map_delay_timer.py
index f7a66fdad1..d791ef486b 100644
--- a/tests/topotests/bgp_route_map_delay_timer/test_bgp_route_map_delay_timer.py
+++ b/tests/topotests/bgp_route_map_delay_timer/test_bgp_route_map_delay_timer.py
@@ -32,7 +32,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_route_map_match_ipv6_nexthop/test_bgp_route_map_match_ipv6_nexthop.py b/tests/topotests/bgp_route_map_match_ipv6_nexthop/test_bgp_route_map_match_ipv6_nexthop.py
index 93a514bf6a..35ce092697 100644
--- a/tests/topotests/bgp_route_map_match_ipv6_nexthop/test_bgp_route_map_match_ipv6_nexthop.py
+++ b/tests/topotests/bgp_route_map_match_ipv6_nexthop/test_bgp_route_map_match_ipv6_nexthop.py
@@ -41,7 +41,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -97,7 +97,7 @@ def test_bgp_route_map_match_ipv6_next_hop_access_list():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_converge, router)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
assert result is None, "Can't match routes using ipv6 next-hop access-list"
diff --git a/tests/topotests/bgp_route_map_match_source_protocol/test_bgp_route_map_match_source_protocol.py b/tests/topotests/bgp_route_map_match_source_protocol/test_bgp_route_map_match_source_protocol.py
index 2828796405..c766f5c1a8 100644
--- a/tests/topotests/bgp_route_map_match_source_protocol/test_bgp_route_map_match_source_protocol.py
+++ b/tests/topotests/bgp_route_map_match_source_protocol/test_bgp_route_map_match_source_protocol.py
@@ -46,7 +46,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_frr_config(os.path.join(CWD, "{}/frr.conf".format(rname)))
tgen.start_router()
diff --git a/tests/topotests/bgp_route_map_on_match_next/test_bgp_route_map_on_match_next.py b/tests/topotests/bgp_route_map_on_match_next/test_bgp_route_map_on_match_next.py
index 8fe45a3498..5b5256f43d 100644
--- a/tests/topotests/bgp_route_map_on_match_next/test_bgp_route_map_on_match_next.py
+++ b/tests/topotests/bgp_route_map_on_match_next/test_bgp_route_map_on_match_next.py
@@ -42,7 +42,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -83,12 +83,12 @@ def test_bgp_route_map_on_match_next():
# Check thst session is established
test_func = functools.partial(_bgp_converge, router2)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert result is None, "Failed bgp convergence on r2"
# Check that metric is 0 and weight is 100 for the received prefix
test_func = functools.partial(_bgp_has_routes, router2, 0, 100)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert result is None, "r2 does not receive routes with metric 0 and weight 100"
# Update the route-map and add "on-match next" to entry 10
@@ -102,7 +102,7 @@ def test_bgp_route_map_on_match_next():
# Check that metric is 20 and weight is 100 for the received prefix
test_func = functools.partial(_bgp_has_routes, router2, 20, 100)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert result is None, "r2 does not receive routes with metric 20 and weight 100"
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
index 37082b484c..5ce8b17f24 100644
--- 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
@@ -61,7 +61,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_route_server_client/test_bgp_route_server_client.py b/tests/topotests/bgp_route_server_client/test_bgp_route_server_client.py
index 18b7831a4a..29d9842d59 100644
--- a/tests/topotests/bgp_route_server_client/test_bgp_route_server_client.py
+++ b/tests/topotests/bgp_route_server_client/test_bgp_route_server_client.py
@@ -44,7 +44,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_rpki_topo1/test_bgp_rpki_topo1.py b/tests/topotests/bgp_rpki_topo1/test_bgp_rpki_topo1.py
index f52b28a062..7b40bbdae8 100644
--- a/tests/topotests/bgp_rpki_topo1/test_bgp_rpki_topo1.py
+++ b/tests/topotests/bgp_rpki_topo1/test_bgp_rpki_topo1.py
@@ -44,7 +44,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_sender_as_path_loop_detection/test_bgp_sender-as-path-loop-detection.py b/tests/topotests/bgp_sender_as_path_loop_detection/test_bgp_sender-as-path-loop-detection.py
index db6dbc61d2..6983a35173 100644
--- a/tests/topotests/bgp_sender_as_path_loop_detection/test_bgp_sender-as-path-loop-detection.py
+++ b/tests/topotests/bgp_sender_as_path_loop_detection/test_bgp_sender-as-path-loop-detection.py
@@ -50,7 +50,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_set_aspath_exclude/test_bgp_set_aspath_exclude.py b/tests/topotests/bgp_set_aspath_exclude/test_bgp_set_aspath_exclude.py
index d373a749fe..64cc48e54f 100644
--- a/tests/topotests/bgp_set_aspath_exclude/test_bgp_set_aspath_exclude.py
+++ b/tests/topotests/bgp_set_aspath_exclude/test_bgp_set_aspath_exclude.py
@@ -46,7 +46,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_set_aspath_replace/test_bgp_set_aspath_replace.py b/tests/topotests/bgp_set_aspath_replace/test_bgp_set_aspath_replace.py
index c0e19fa356..fe4eda60f5 100644
--- a/tests/topotests/bgp_set_aspath_replace/test_bgp_set_aspath_replace.py
+++ b/tests/topotests/bgp_set_aspath_replace/test_bgp_set_aspath_replace.py
@@ -48,7 +48,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_set_local_preference_add_subtract/test_bgp_set_local-preference_add_subtract.py b/tests/topotests/bgp_set_local_preference_add_subtract/test_bgp_set_local-preference_add_subtract.py
index 292cf70d36..e201ec9ff7 100644
--- a/tests/topotests/bgp_set_local_preference_add_subtract/test_bgp_set_local-preference_add_subtract.py
+++ b/tests/topotests/bgp_set_local_preference_add_subtract/test_bgp_set_local-preference_add_subtract.py
@@ -47,7 +47,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -100,12 +100,12 @@ def test_bgp_set_local_preference():
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_converge, router)
- success, result = topotest.run_and_expect(test_func, None, count=15, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=15, wait=0.5)
assert result is None, 'Failed to see BGP convergence in "{}"'.format(router)
test_func = functools.partial(_bgp_check_local_preference, router)
- success, result = topotest.run_and_expect(test_func, None, count=15, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=15, wait=0.5)
assert result is None, 'Failed to see applied BGP local-preference in "{}"'.format(
router
diff --git a/tests/topotests/bgp_software_version/test_bgp_software_version.py b/tests/topotests/bgp_software_version/test_bgp_software_version.py
index c867208d39..9aff53a030 100644
--- a/tests/topotests/bgp_software_version/test_bgp_software_version.py
+++ b/tests/topotests/bgp_software_version/test_bgp_software_version.py
@@ -34,7 +34,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_soo/test_bgp_soo.py b/tests/topotests/bgp_soo/test_bgp_soo.py
index 967bed0213..b0c70f208e 100644
--- a/tests/topotests/bgp_soo/test_bgp_soo.py
+++ b/tests/topotests/bgp_soo/test_bgp_soo.py
@@ -73,7 +73,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_srv6l3vpn_sid/test_bgp_srv6l3vpn_sid.py b/tests/topotests/bgp_srv6l3vpn_sid/test_bgp_srv6l3vpn_sid.py
index 984cf97e28..787707cc0f 100755
--- a/tests/topotests/bgp_srv6l3vpn_sid/test_bgp_srv6l3vpn_sid.py
+++ b/tests/topotests/bgp_srv6l3vpn_sid/test_bgp_srv6l3vpn_sid.py
@@ -106,7 +106,7 @@ def setup_module(mod):
tgen = Topogen(build_topo, mod.__name__)
tgen.start_topology()
router_list = tgen.routers()
- for i, (rname, router) in enumerate(tgen.routers().items(), 1):
+ for _, (rname, router) in enumerate(tgen.routers().items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -180,7 +180,7 @@ def check_rib(name, cmd, expected_file):
logger.info('[+] check {} "{}" {}'.format(name, cmd, expected_file))
tgen = get_topogen()
func = functools.partial(_check, name, cmd, expected_file)
- success, result = topotest.run_and_expect(func, None, count=10, wait=0.5)
+ _, result = topotest.run_and_expect(func, None, count=10, wait=0.5)
assert result is None, "Failed"
diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/test_bgp_srv6l3vpn_to_bgp_vrf.py b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/test_bgp_srv6l3vpn_to_bgp_vrf.py
index 4afaeaf78a..5d18083fd5 100755
--- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/test_bgp_srv6l3vpn_to_bgp_vrf.py
+++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/test_bgp_srv6l3vpn_to_bgp_vrf.py
@@ -147,7 +147,7 @@ def check_rib(name, cmd, expected_file):
logger.info('[+] check {} "{}" {}'.format(name, cmd, expected_file))
tgen = get_topogen()
func = functools.partial(_check, name, cmd, expected_file)
- success, result = topotest.run_and_expect(func, None, count=10, wait=0.5)
+ _, result = topotest.run_and_expect(func, None, count=10, wait=0.5)
assert result is None, "Failed"
diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/test_bgp_srv6l3vpn_to_bgp_vrf2.py b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/test_bgp_srv6l3vpn_to_bgp_vrf2.py
index 914c29f0c1..38baf43442 100755
--- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/test_bgp_srv6l3vpn_to_bgp_vrf2.py
+++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/test_bgp_srv6l3vpn_to_bgp_vrf2.py
@@ -109,7 +109,7 @@ def check_rib(name, cmd, expected_file):
logger.info('[+] check {} "{}" {}'.format(name, cmd, expected_file))
tgen = get_topogen()
func = functools.partial(_check, name, cmd, expected_file)
- success, result = topotest.run_and_expect(func, None, count=10, wait=0.5)
+ _, result = topotest.run_and_expect(func, None, count=10, wait=0.5)
assert result is None, "Failed"
diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/test_bgp_srv6l3vpn_to_bgp_vrf3.py b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/test_bgp_srv6l3vpn_to_bgp_vrf3.py
index 8a7b558be3..92a30788fc 100644
--- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/test_bgp_srv6l3vpn_to_bgp_vrf3.py
+++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/test_bgp_srv6l3vpn_to_bgp_vrf3.py
@@ -106,7 +106,7 @@ def check_rib(name, cmd, expected_file):
logger.info('[+] check {} "{}" {}'.format(name, cmd, expected_file))
tgen = get_topogen()
func = functools.partial(_check, name, cmd, expected_file)
- success, result = topotest.run_and_expect(func, None, count=10, wait=0.5)
+ _, result = topotest.run_and_expect(func, None, count=10, wait=0.5)
assert result is None, "Failed"
diff --git a/tests/topotests/bgp_suppress_fib/test_bgp_suppress_fib.py b/tests/topotests/bgp_suppress_fib/test_bgp_suppress_fib.py
index ec14ef065f..fa8a88297f 100644
--- a/tests/topotests/bgp_suppress_fib/test_bgp_suppress_fib.py
+++ b/tests/topotests/bgp_suppress_fib/test_bgp_suppress_fib.py
@@ -47,7 +47,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_tcp_mss/test_bgp_tcp_mss.py b/tests/topotests/bgp_tcp_mss/test_bgp_tcp_mss.py
index 4855d5c7d2..37949cdc99 100644
--- a/tests/topotests/bgp_tcp_mss/test_bgp_tcp_mss.py
+++ b/tests/topotests/bgp_tcp_mss/test_bgp_tcp_mss.py
@@ -52,7 +52,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -108,7 +108,7 @@ def test_bgp_tcp_mss():
logger.info("Check if neighbor sessions are up in {}".format(router1.name))
test_func = functools.partial(_bgp_converge, router1)
- success, result = topotest.run_and_expect(test_func, None, count=15, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=15, wait=0.5)
assert result is None, 'Failed to see BGP convergence in "{}"'.format(router1.name)
logger.info("BGP neighbor session is up in {}".format(router1.name))
@@ -129,7 +129,7 @@ def test_bgp_tcp_mss():
"Check if neighbor session is up after reset in {}".format(router1.name)
)
test_func = functools.partial(_bgp_converge, router1)
- success, result = topotest.run_and_expect(test_func, None, count=15, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=15, wait=0.5)
assert result is None, 'Failed to see BGP convergence after reset in "{}"'.format(
router1.name
)
@@ -138,7 +138,7 @@ def test_bgp_tcp_mss():
"Verify if TCP MSS value is synced with neighbor in {}".format(router1.name)
)
test_func = functools.partial(_bgp_check_neighbor_tcp_mss, router1, "192.168.255.2")
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert (
result is None
), 'Failed to sync TCP MSS value over BGP session in "{}"'.format(router1.name)
@@ -148,7 +148,7 @@ def test_bgp_tcp_mss():
"Verify if TCP MSS value is synced with neighbor in {}".format(router2.name)
)
test_func = functools.partial(_bgp_check_neighbor_tcp_mss, router2, "192.168.255.1")
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert (
result is None
), 'Failed to sync TCP MSS value over BGP session in "{}"'.format(router2.name)
diff --git a/tests/topotests/bgp_tcp_mss_passive/test_bgp_tcp_mss_passive.py b/tests/topotests/bgp_tcp_mss_passive/test_bgp_tcp_mss_passive.py
index cd405f7b22..a2eacc7ab2 100644
--- a/tests/topotests/bgp_tcp_mss_passive/test_bgp_tcp_mss_passive.py
+++ b/tests/topotests/bgp_tcp_mss_passive/test_bgp_tcp_mss_passive.py
@@ -41,7 +41,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_frr_config(os.path.join(CWD, "{}/frr.conf".format(rname)))
tgen.start_router()
diff --git a/tests/topotests/bgp_unnumbered/test_bgp_unnumbered.py b/tests/topotests/bgp_unnumbered/test_bgp_unnumbered.py
index 2a53547f59..4d4e29b2f8 100644
--- a/tests/topotests/bgp_unnumbered/test_bgp_unnumbered.py
+++ b/tests/topotests/bgp_unnumbered/test_bgp_unnumbered.py
@@ -42,7 +42,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -84,7 +84,7 @@ def test_bgp_unnumbered_removal():
step("Ensure Convergence of BGP")
test_func = functools.partial(_bgp_converge)
- success, result = topotest.run_and_expect(test_func, None, count=60, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=1)
assert result is None, 'Failed bgp convergence in "{}"'.format(tgen.gears["r2"])
@@ -109,7 +109,7 @@ def test_bgp_unnumbered_removal():
step("Ensure that BGP does not crash")
test_func = functools.partial(_bgp_nexthop_cache)
- success, result = topotest.run_and_expect(test_func, True, count=10, wait=1)
+ _, result = topotest.run_and_expect(test_func, True, count=10, wait=1)
assert result is True, "BGP did not crash on r1"
diff --git a/tests/topotests/bgp_update_delay/test_bgp_update_delay.py b/tests/topotests/bgp_update_delay/test_bgp_update_delay.py
index 4e66cf5548..59f4bcd385 100644
--- a/tests/topotests/bgp_update_delay/test_bgp_update_delay.py
+++ b/tests/topotests/bgp_update_delay/test_bgp_update_delay.py
@@ -90,7 +90,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
@@ -169,7 +169,7 @@ def test_bgp_update_delay():
# Check r2 initial convergence in default table
test_func = functools.partial(_bgp_converge, router2)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
assert result is None, 'Failed bgp convergence in "{}"'.format(router2)
@@ -195,7 +195,7 @@ def test_bgp_update_delay():
router2.vtysh_cmd("""clear ip bgp *""")
test_func = functools.partial(_bgp_check_update_delay_in_progress, router2)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
assert result is None, 'Failed to set update-delay max-delay timer "{}"'.format(
router2
@@ -203,7 +203,7 @@ def test_bgp_update_delay():
# Check that r2 only installs route learned from r4 after the max-delay timer expires
test_func = functools.partial(_bgp_check_route_install, router2)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
assert result is None, 'Failed to install route after update-delay "{}"'.format(
router2
@@ -219,7 +219,7 @@ def test_bgp_update_delay():
)
test_func = functools.partial(_bgp_check_update_delay_and_wait, router2)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
assert (
result is None
@@ -229,7 +229,7 @@ def test_bgp_update_delay():
router2.vtysh_cmd("""clear ip bgp *""")
test_func = functools.partial(_bgp_check_route_install, router3)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
assert (
result is None
@@ -250,7 +250,7 @@ def test_bgp_update_delay():
router2.vtysh_cmd("""clear ip bgp *""")
test_func = functools.partial(_bgp_check_route_install, router2)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
assert result is None, 'Failed to remove update-delay delay timing "{}"'.format(
router2
@@ -266,14 +266,14 @@ def test_bgp_update_delay():
# Check that r2 default instance and vrf1 have the max-delay and establish set
test_func = functools.partial(_bgp_check_update_delay_and_wait, router2)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
assert result is None, 'Failed to set update-delay in default instance "{}"'.format(
router2
)
test_func = functools.partial(_bgp_check_vrf_update_delay_and_wait, router2)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
assert result is None, 'Failed to set update-delay in vrf1 "{}"'.format(router2)
@@ -281,7 +281,7 @@ def test_bgp_update_delay():
router2.vtysh_cmd("""clear ip bgp *""")
test_func = functools.partial(_bgp_check_route_install, router3)
- success, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
assert (
result is None
diff --git a/tests/topotests/bgp_vpn_5549_route_map/test_bgp_vpn_5549_route_map.py b/tests/topotests/bgp_vpn_5549_route_map/test_bgp_vpn_5549_route_map.py
index eb29875d50..695cfc3d25 100644
--- a/tests/topotests/bgp_vpn_5549_route_map/test_bgp_vpn_5549_route_map.py
+++ b/tests/topotests/bgp_vpn_5549_route_map/test_bgp_vpn_5549_route_map.py
@@ -67,7 +67,7 @@ def setup_module(mod):
router_list = tgen.routers()
- for i, (rname, router) in enumerate(router_list.items(), 1):
+ for _, (rname, router) in enumerate(router_list.items(), 1):
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_vpnv4_asbr/test_bgp_vpnv4_asbr.py b/tests/topotests/bgp_vpnv4_asbr/test_bgp_vpnv4_asbr.py
index 39865eb189..8e2e4017df 100644
--- a/tests/topotests/bgp_vpnv4_asbr/test_bgp_vpnv4_asbr.py
+++ b/tests/topotests/bgp_vpnv4_asbr/test_bgp_vpnv4_asbr.py
@@ -203,7 +203,7 @@ def bgp_vpnv4_prefix_check(router, rd, prefix, label, nexthop):
)
func = functools.partial(_check, router, prefix, rd, label, nexthop)
- success, result = topotest.run_and_expect(func, None, count=20, wait=0.5)
+ _, result = topotest.run_and_expect(func, None, count=20, wait=0.5)
assert_msg = "{}, show bgp ipv4 vpn {}, rd {}, label {} nexthop {}".format(
router.name, prefix, rd, label, nexthop
)
@@ -324,7 +324,7 @@ def check_show_bgp_vpn_ok(router, vpnv4_entries):
for prefix, rname_to_test in vpnv4_entries.items():
func = functools.partial(_check_nexthop_available, router, prefix)
- success, result = topotest.run_and_expect(func, None, count=20, wait=0.5)
+ _, result = topotest.run_and_expect(func, None, count=20, wait=0.5)
assert result is None, "Failed to detect prefix {} on router {}".format(
prefix, router.name
)
@@ -456,7 +456,7 @@ def test_r3_prefixes_removed():
prefix,
"444:3",
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "{}, vpnv4 update {} still present".format(router.name, prefix)
# diagnostic
@@ -491,7 +491,7 @@ def test_r3_prefixes_removed():
prefix,
"444:3",
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "{}, vpnv4 update {} still present".format(router.name, prefix)
logger.info(
@@ -502,7 +502,7 @@ def test_r3_prefixes_removed():
test_func = functools.partial(
check_show_mpls_table_entry_label_not_found, router, label_ip_entries[prefix]
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "r1, mpls entry with in_label {} still present".format(
label_ip_entries[prefix]
)
@@ -536,7 +536,7 @@ def test_r3_prefixes_added_back():
prefix,
"444:3",
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "{}, vpnv4 update {} not present".format(router.name, prefix)
logger.info(
@@ -564,7 +564,7 @@ def test_r3_prefixes_added_back():
prefix,
"444:3",
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "{}, vpnv4 update {} not present".format(router.name, prefix)
# diagnostic
@@ -611,7 +611,7 @@ def test_unconfigure_nexthop_change_nexthop_self():
test_func = functools.partial(
check_show_mpls_table_entry_label_not_found, router, label
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "r1, mpls entry for {} with in_label {} still present".format(
prefix, label
)
@@ -626,7 +626,7 @@ def test_unconfigure_nexthop_change_nexthop_self():
"444:3",
label=label,
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "{}, mpls vpn update {} label {} is present".format(
router.name, prefix, label
)
@@ -639,7 +639,7 @@ def test_unconfigure_nexthop_change_nexthop_self():
"444:3",
nexthop="192.168.1.3",
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "{}, mpls vpn update {} label {} is present".format(
router.name, prefix, label
)
@@ -727,7 +727,7 @@ def test_declare_vpn_network_with_different_label():
label=label,
nexthop="192.168.1.3",
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "{}, vpnv4 update {}, label {} not present".format(
router.name, prefix, label
)
@@ -787,7 +787,7 @@ def test_filter_vpn_network_from_r1():
"172.31.0.0/24",
"444:1",
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "{}, vpnv4 update {}, is still present".format(
router.name, prefix
)
@@ -804,7 +804,7 @@ def test_filter_vpn_network_from_r1():
test_func = functools.partial(
check_show_mpls_table_entry_label_not_found, router, int(label)
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "r1, mpls entry for {} with in_label {} still present".format(
prefix, label
)
@@ -833,7 +833,7 @@ def test_unfilter_vpn_network_from_r1():
test_func = functools.partial(
check_show_bgp_vpn_prefix_found, router, "ipv4", prefix, "444:1"
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "{}, vpnv4 update {}, is not present".format(router.name, prefix)
vpnv4_checks = {
diff --git a/tests/topotests/bgp_vpnv4_ebgp/test_bgp_vpnv4_ebgp.py b/tests/topotests/bgp_vpnv4_ebgp/test_bgp_vpnv4_ebgp.py
index 189824311d..dd9d54742b 100644
--- a/tests/topotests/bgp_vpnv4_ebgp/test_bgp_vpnv4_ebgp.py
+++ b/tests/topotests/bgp_vpnv4_ebgp/test_bgp_vpnv4_ebgp.py
@@ -245,7 +245,7 @@ router bgp 65500 vrf vrf1
prefix,
"444:1",
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "{}, vpnv4 update {} still present".format(router.name, prefix)
@@ -279,7 +279,7 @@ route-map RMAP permit 1
prefix,
"444:1",
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "{}, vpnv4 update {} still not present".format(router.name, prefix)
@@ -309,7 +309,7 @@ route-map RMAP permit 1
prefix,
"444:1",
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "{}, vpnv4 update {} still present".format(router.name, prefix)
@@ -339,7 +339,7 @@ router bgp 65500 vrf vrf1
prefix,
"444:1",
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "{}, vpnv4 update {} still not present".format(router.name, prefix)
@@ -371,7 +371,7 @@ route-map RMAP permit 1
prefix,
"444:1",
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "{}, vpnv4 update {} still present".format(router.name, prefix)
@@ -400,7 +400,7 @@ route-map RMAP permit 1
prefix,
"444:1",
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "{}, vpnv4 update {} still not present".format(router.name, prefix)
@@ -482,7 +482,7 @@ router bgp 65501
expected,
exact=True,
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "r2, vpnv4 update 172.31.0.1 still present"
diff --git a/tests/topotests/bgp_vpnv4_per_nexthop_label/test_bgp_vpnv4_per_nexthop_label.py b/tests/topotests/bgp_vpnv4_per_nexthop_label/test_bgp_vpnv4_per_nexthop_label.py
index d4c355a44a..b017880545 100644
--- a/tests/topotests/bgp_vpnv4_per_nexthop_label/test_bgp_vpnv4_per_nexthop_label.py
+++ b/tests/topotests/bgp_vpnv4_per_nexthop_label/test_bgp_vpnv4_per_nexthop_label.py
@@ -174,7 +174,7 @@ def bgp_vpnv4_table_check(router, group, label_list=None, label_value_expected=N
stored_label_inited = False
for prefix in group:
test_func = functools.partial(check_bgp_vpnv4_prefix_presence, router, prefix)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "{}, prefix ipv4 vpn {} is not installed yet".format(
router.name, prefix
)
@@ -305,7 +305,7 @@ def mpls_table_check(router, blacklist=None, label_list=None, whitelist=None):
test_func = functools.partial(
check_show_mpls_table, router, blacklist, label_list, whitelist
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "{}, MPLS labels check fail: {}".format(router.name, result)
@@ -450,7 +450,7 @@ def test_flapping_bgp_vrf_down():
test_func = functools.partial(
_bgp_prefix_not_found, tgen.gears["r1"], "vrf1", "ipv4", "172.31.0.11/32"
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert (
success
), "r1, prefix 172.31.0.11/32 from r11 did not disappear. r11 still connected to rr ?"
@@ -488,7 +488,7 @@ def test_flapping_bgp_vrf_up():
"172.31.0.11/32",
"444:1",
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert (
success
), "r2, prefix 172.31.0.11/32 from r11 not present. r11 still disconnected from rr ?"
@@ -518,7 +518,7 @@ def test_recursive_route():
"172.31.0.30/32",
"444:1",
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "r2, vpnv4 update 172.31.0.30 not found"
bgp_vpnv4_table_check(tgen.gears["r2"], group=PREFIXES_R11 + ["172.31.0.30/32"])
@@ -544,7 +544,7 @@ def test_recursive_route():
"172.31.0.30/32",
"444:1",
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "r2, vpnv4 update 172.31.0.30 still present"
@@ -570,7 +570,7 @@ def test_prefix_changes_interface():
"172.31.0.50/32",
"444:1",
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "r2, vpnv4 update 172.31.0.50 not found"
# diagnostic
@@ -616,7 +616,7 @@ def test_prefix_changes_interface():
"444:1",
label=oldlabel,
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert (
success
), "r2, vpnv4 update 172.31.0.50 with old label {0} still present".format(oldlabel)
@@ -633,7 +633,7 @@ def test_prefix_changes_interface():
"172.31.0.50/32",
"444:1",
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "r2, vpnv4 update 172.31.0.50 not found"
label_list = set()
@@ -699,7 +699,7 @@ def test_changing_default_label_value():
test_func = functools.partial(
check_show_mpls_table_entry_label_found, router, 222, "vrf1"
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "r1, mpls entry with label 222 not found"
# check label repartition is ok
@@ -746,7 +746,7 @@ def test_unconfigure_allocation_mode_nexthop():
test_func = functools.partial(
check_show_mpls_table_entry_label_not_found, router, 17
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "r1, mpls entry with label 17 still present"
# Check vpnv4 routes from r1
@@ -794,7 +794,7 @@ def test_reconfigure_allocation_mode_nexthop():
test_func = functools.partial(
check_show_mpls_table_entry_label_not_found, router, 17
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "r1, mpls entry with label 17 still present"
# Check vpnv4 routes from r1
diff --git a/tests/topotests/bgp_vpnv6_per_nexthop_label/test_bgp_vpnv6_per_nexthop_label.py b/tests/topotests/bgp_vpnv6_per_nexthop_label/test_bgp_vpnv6_per_nexthop_label.py
index 3d5f8f643b..3879687aac 100644
--- a/tests/topotests/bgp_vpnv6_per_nexthop_label/test_bgp_vpnv6_per_nexthop_label.py
+++ b/tests/topotests/bgp_vpnv6_per_nexthop_label/test_bgp_vpnv6_per_nexthop_label.py
@@ -173,7 +173,7 @@ def bgp_vpnv6_table_check(router, group, label_list=None, label_value_expected=N
stored_label_inited = False
for prefix in group:
test_func = functools.partial(check_bgp_vpnv6_prefix_presence, router, prefix)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "{}, prefix ipv6 vpn {} is not installed yet".format(
router.name, prefix
)
@@ -300,7 +300,7 @@ def mpls_table_check(router, blacklist=None, label_list=None, whitelist=None):
test_func = functools.partial(
check_show_mpls_table, router, blacklist, label_list, whitelist
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "{}, MPLS labels check fail: {}".format(router.name, result)
@@ -446,7 +446,7 @@ def test_flapping_bgp_vrf_down():
test_func = functools.partial(
_bgp_prefix_not_found, tgen.gears["r1"], "vrf1", "ipv6", "172:31::11/128"
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert (
success
), "r1, prefix 172:31::11/128 from r11 did not disappear. r11 still connected to rr ?"
@@ -488,7 +488,7 @@ def test_flapping_bgp_vrf_up():
"172:31::11/128",
"444:1",
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert (
success
), "r2, prefix 172:31::11/128 from r11 not present. r11 still disconnected from rr ?"
@@ -526,7 +526,7 @@ def test_recursive_route():
# Check r2 received vpnv6 update with 172:31::30
test_func = functools.partial(_prefix30_found, tgen.gears["r2"])
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "r2, VPNv6 update 172:31::30 not found"
# that route should be sent along with label for 192::2:11
@@ -549,7 +549,7 @@ def test_recursive_route():
# Check r2 removed 172:31::30 vpnv6 update
test_func = functools.partial(_prefix30_not_found, tgen.gears["r2"])
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "r2, VPNv6 update 172:31::30 still present"
@@ -575,7 +575,7 @@ def test_prefix_changes_interface():
"172:31::50/128",
"444:1",
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "r2, VPNv6 update 172:31::50 not found"
# diagnostic
@@ -621,7 +621,7 @@ def test_prefix_changes_interface():
"444:1",
label=oldlabel,
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert (
success
), "r2, vpnv6 update 172:31::50 with old label {0} still present".format(oldlabel)
@@ -638,7 +638,7 @@ def test_prefix_changes_interface():
"172:31::50/128",
"444:1",
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "r2, vpnv6 update 172:31::50 not found"
label_list = set()
@@ -704,7 +704,7 @@ def test_changing_default_label_value():
test_func = functools.partial(
check_show_mpls_table_entry_label_found, router, 222, "vrf1"
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "r1, mpls entry with label 222 not found"
# check label repartition is ok
@@ -750,7 +750,7 @@ def test_unconfigure_allocation_mode_nexthop():
test_func = functools.partial(
check_show_mpls_table_entry_label_not_found, router, 17
)
- success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ success, _ = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "r1, mpls entry with label 17 still present"
# Check vpnv6 routes from r1
diff --git a/tests/topotests/bgp_weighted_ecmp_recursive/__init__.py b/tests/topotests/bgp_weighted_ecmp_recursive/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/topotests/bgp_weighted_ecmp_recursive/__init__.py
diff --git a/tests/topotests/bgp_weighted_ecmp_recursive/r1/frr.conf b/tests/topotests/bgp_weighted_ecmp_recursive/r1/frr.conf
new file mode 100644
index 0000000000..f7c591f75f
--- /dev/null
+++ b/tests/topotests/bgp_weighted_ecmp_recursive/r1/frr.conf
@@ -0,0 +1,16 @@
+!
+int r1-eth0
+ ip address 192.168.12.1/24
+!
+int r1-eth1
+ ip address 192.168.13.1/24
+!
+router bgp 65000
+ no bgp ebgp-requires-policy
+ neighbor 192.168.12.2 remote-as internal
+ neighbor 192.168.12.2 timers 1 3
+ neighbor 192.168.12.2 timers connect 1
+ neighbor 192.168.13.3 remote-as internal
+ neighbor 192.168.13.3 timers 1 3
+ neighbor 192.168.13.3 timers connect 1
+!
diff --git a/tests/topotests/bgp_weighted_ecmp_recursive/r2/frr.conf b/tests/topotests/bgp_weighted_ecmp_recursive/r2/frr.conf
new file mode 100644
index 0000000000..dc25d4781c
--- /dev/null
+++ b/tests/topotests/bgp_weighted_ecmp_recursive/r2/frr.conf
@@ -0,0 +1,20 @@
+!
+int r2-eth0
+ ip address 192.168.12.2/24
+!
+int r2-eth1
+ ip address 192.168.24.2/24
+!
+router bgp 65000
+ no bgp ebgp-requires-policy
+ neighbor 192.168.12.1 remote-as internal
+ neighbor 192.168.12.1 timers 1 3
+ neighbor 192.168.12.1 timers connect 1
+ neighbor 192.168.24.4 remote-as internal
+ neighbor 192.168.24.4 timers 1 3
+ neighbor 192.168.24.4 timers connect 1
+ address-family ipv4 unicast
+ redistribute connected
+ neighbor 192.168.12.1 route-reflector-client
+ exit-address-family
+!
diff --git a/tests/topotests/bgp_weighted_ecmp_recursive/r3/frr.conf b/tests/topotests/bgp_weighted_ecmp_recursive/r3/frr.conf
new file mode 100644
index 0000000000..bdeb35b50f
--- /dev/null
+++ b/tests/topotests/bgp_weighted_ecmp_recursive/r3/frr.conf
@@ -0,0 +1,20 @@
+!
+int r3-eth0
+ ip address 192.168.13.3/24
+!
+int r3-eth1
+ ip address 192.168.35.3/24
+!
+router bgp 65000
+ no bgp ebgp-requires-policy
+ neighbor 192.168.13.1 remote-as internal
+ neighbor 192.168.13.1 timers 1 3
+ neighbor 192.168.13.1 timers connect 1
+ neighbor 192.168.35.5 remote-as internal
+ neighbor 192.168.35.5 timers 1 3
+ neighbor 192.168.35.5 timers connect 1
+ address-family ipv4 unicast
+ redistribute connected
+ neighbor 192.168.13.1 route-reflector-client
+ exit-address-family
+!
diff --git a/tests/topotests/bgp_weighted_ecmp_recursive/r4/frr.conf b/tests/topotests/bgp_weighted_ecmp_recursive/r4/frr.conf
new file mode 100644
index 0000000000..0662a4dc49
--- /dev/null
+++ b/tests/topotests/bgp_weighted_ecmp_recursive/r4/frr.conf
@@ -0,0 +1,17 @@
+!
+int r4-eth0
+ ip address 192.168.24.4/24
+!
+router bgp 65000
+ no bgp ebgp-requires-policy
+ no bgp network import-check
+ neighbor 192.168.24.2 remote-as internal
+ neighbor 192.168.24.2 timers 1 3
+ neighbor 192.168.24.2 timers connect 1
+ address-family ipv4 unicast
+ network 10.10.10.10/32 route-map rmap
+ exit-address-family
+!
+route-map rmap permit 10
+ set extcommunity bandwidth 4000
+exit
diff --git a/tests/topotests/bgp_weighted_ecmp_recursive/r5/frr.conf b/tests/topotests/bgp_weighted_ecmp_recursive/r5/frr.conf
new file mode 100644
index 0000000000..bc24a96b51
--- /dev/null
+++ b/tests/topotests/bgp_weighted_ecmp_recursive/r5/frr.conf
@@ -0,0 +1,17 @@
+!
+int r5-eth0
+ ip address 192.168.35.5/24
+!
+router bgp 65000
+ no bgp ebgp-requires-policy
+ no bgp network import-check
+ neighbor 192.168.35.3 remote-as internal
+ neighbor 192.168.35.3 timers 1 3
+ neighbor 192.168.35.3 timers connect 1
+ address-family ipv4 unicast
+ network 10.10.10.10/32 route-map rmap
+ exit-address-family
+!
+route-map rmap permit 10
+ set extcommunity bandwidth 5000
+exit
diff --git a/tests/topotests/bgp_weighted_ecmp_recursive/test_bgp_weighted_ecmp_recursive.py b/tests/topotests/bgp_weighted_ecmp_recursive/test_bgp_weighted_ecmp_recursive.py
new file mode 100644
index 0000000000..7a6d068e56
--- /dev/null
+++ b/tests/topotests/bgp_weighted_ecmp_recursive/test_bgp_weighted_ecmp_recursive.py
@@ -0,0 +1,109 @@
+#!/usr/bin/env python
+# SPDX-License-Identifier: ISC
+
+# Copyright (c) 2024 by
+# Donatas Abraitis <donatas@opensourcerouting.org>
+#
+
+"""
+Test if weighted ECMP works and recursive weight (link bandwidth) is
+inherited to non-recursive next-hops.
+"""
+
+import os
+import re
+import sys
+import json
+import pytest
+import functools
+
+pytestmark = [pytest.mark.bgpd]
+
+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
+
+
+def setup_module(mod):
+ topodef = {
+ "s1": ("r1", "r2"),
+ "s2": ("r1", "r3"),
+ "s3": ("r2", "r4"),
+ "s4": ("r3", "r5"),
+ }
+ tgen = Topogen(topodef, mod.__name__)
+ tgen.start_topology()
+
+ router_list = tgen.routers()
+
+ for _, (rname, router) in enumerate(router_list.items(), 1):
+ router.load_frr_config(os.path.join(CWD, "{}/frr.conf".format(rname)))
+
+ tgen.start_router()
+
+
+def teardown_module(mod):
+ tgen = get_topogen()
+ tgen.stop_topology()
+
+
+def test_bgp_weighted_ecmp_recursive():
+ tgen = get_topogen()
+
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ r1 = tgen.gears["r1"]
+
+ def _bgp_converge():
+ output = json.loads(r1.vtysh_cmd("show ip route 10.10.10.10/32 json"))
+ expected = {
+ "10.10.10.10/32": [
+ {
+ "selected": True,
+ "installed": True,
+ "nexthops": [
+ {
+ "ip": "192.168.24.4",
+ "active": True,
+ "recursive": True,
+ "weight": 204,
+ },
+ {
+ "ip": "192.168.12.2",
+ "active": True,
+ "resolver": True,
+ "weight": 204,
+ },
+ {
+ "ip": "192.168.35.5",
+ "active": True,
+ "recursive": True,
+ "weight": 255,
+ },
+ {
+ "ip": "192.168.13.3",
+ "active": True,
+ "resolver": True,
+ "weight": 255,
+ },
+ ],
+ }
+ ]
+ }
+ return topotest.json_cmp(output, expected)
+
+ test_func = functools.partial(
+ _bgp_converge,
+ )
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
+ assert result is None, "Can't converge"
+
+
+if __name__ == "__main__":
+ args = ["-s"] + sys.argv[1:]
+ sys.exit(pytest.main(args))
diff --git a/tests/topotests/lib/common_check.py b/tests/topotests/lib/common_check.py
new file mode 100644
index 0000000000..be3241fd20
--- /dev/null
+++ b/tests/topotests/lib/common_check.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+# SPDX-License-Identifier: ISC
+#
+# common_check.py
+#
+# Copyright 2024 6WIND S.A.
+
+#
+import json
+from lib import topotest
+
+
+def ip_check_path_selection(router, ipaddr_str, expected, vrf_name=None):
+ if vrf_name:
+ cmdstr = f'show ip route vrf {vrf_name} {ipaddr_str} json'
+ else:
+ cmdstr = f'show ip route {ipaddr_str} json'
+ try:
+ output = json.loads(router.vtysh_cmd(cmdstr))
+ except:
+ output = {}
+
+ ret = topotest.json_cmp(output, expected)
+ if ret is None:
+ num_nh_expected = len(expected[ipaddr_str][0]["nexthops"])
+ num_nh_observed = len(output[ipaddr_str][0]["nexthops"])
+ if num_nh_expected == num_nh_observed:
+ return ret
+ return "{}, prefix {} does not have the correct number of nexthops : observed {}, expected {}".format(
+ router.name, ipaddr_str, num_nh_observed, num_nh_expected
+ )
+ return ret
+
+
+def iproute2_check_path_selection(router, ipaddr_str, expected, vrf_name=None):
+ if not topotest.iproute2_is_json_capable():
+ return None
+
+ if vrf_name:
+ cmdstr = f'ip -json route show vrf {vrf_name} {ipaddr_str}'
+ else:
+ cmdstr = f'ip -json route show {ipaddr_str}'
+ try:
+ output = json.loads(cmdstr)
+ except:
+ output = []
+
+ return topotest.json_cmp(output, expected)
diff --git a/tests/topotests/lib/topotest.py b/tests/topotests/lib/topotest.py
index 087d8454fc..1d4bc2eac6 100644
--- a/tests/topotests/lib/topotest.py
+++ b/tests/topotests/lib/topotest.py
@@ -602,6 +602,30 @@ def is_linux():
return False
+def iproute2_is_json_capable():
+ """
+ Checks if the iproute2 version installed on the system is capable of
+ handling JSON outputss
+
+ Returns True if capability can be detected, returns False otherwise.
+ """
+ if is_linux():
+ try:
+ subp = subprocess.Popen(
+ ["ip", "-json", "route", "show"],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ stdin=subprocess.PIPE,
+ )
+ iproute2_err = subp.communicate()[1].splitlines()[0].split()[0]
+
+ if iproute2_err != "Error:":
+ return True
+ except Exception:
+ pass
+ return False
+
+
def iproute2_is_vrf_capable():
"""
Checks if the iproute2 version installed on the system is capable of
diff --git a/tests/topotests/nhrp_topo/r1/nhrpd.conf b/tests/topotests/nhrp_topo/r1/nhrpd.conf
index e5224e4aab..8ade77d07d 100644
--- a/tests/topotests/nhrp_topo/r1/nhrpd.conf
+++ b/tests/topotests/nhrp_topo/r1/nhrpd.conf
@@ -1,7 +1,8 @@
log stdout debugging
! debug nhrp all
interface r1-gre0
- ip nhrp holdtime 500
+ ip nhrp authentication secret
+ ip nhrp holdtime 10
ip nhrp shortcut
ip nhrp network-id 42
ip nhrp nhs dynamic nbma 10.2.1.2
diff --git a/tests/topotests/nhrp_topo/r2/nhrpd.conf b/tests/topotests/nhrp_topo/r2/nhrpd.conf
index f9185f9a63..d8e59936c8 100644
--- a/tests/topotests/nhrp_topo/r2/nhrpd.conf
+++ b/tests/topotests/nhrp_topo/r2/nhrpd.conf
@@ -2,7 +2,8 @@
log stdout debugging
nhrp nflog-group 1
interface r2-gre0
- ip nhrp holdtime 500
+ ip nhrp authentication secret
+ ip nhrp holdtime 10
ip nhrp redirect
ip nhrp network-id 42
ip nhrp registration no-unique
diff --git a/tests/topotests/nhrp_topo/test_nhrp_topo.py b/tests/topotests/nhrp_topo/test_nhrp_topo.py
index 284c58a8e7..8833003107 100644
--- a/tests/topotests/nhrp_topo/test_nhrp_topo.py
+++ b/tests/topotests/nhrp_topo/test_nhrp_topo.py
@@ -28,7 +28,7 @@ sys.path.append(os.path.join(CWD, "../"))
from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger
-from lib.common_config import required_linux_kernel_version
+from lib.common_config import required_linux_kernel_version, retry
# Required to instantiate the topology builder class.
@@ -214,19 +214,64 @@ def test_protocols_convergence():
def test_nhrp_connection():
"Assert that the NHRP peers can find themselves."
tgen = get_topogen()
+ pingrouter = tgen.gears["r1"]
+ hubrouter = tgen.gears["r2"]
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
- pingrouter = tgen.gears["r1"]
- logger.info("Check Ping IPv4 from R1 to R2 = 10.255.255.2)")
- output = pingrouter.run("ping 10.255.255.2 -f -c 1000")
- logger.info(output)
- if "1000 packets transmitted, 1000 received" not in output:
- assertmsg = "expected ping IPv4 from R1 to R2 should be ok"
- assert 0, assertmsg
- else:
- logger.info("Check Ping IPv4 from R1 to R2 OK")
-
+ def ping_helper():
+ output = pingrouter.run("ping 10.255.255.2 -f -c 100")
+ logger.info(output)
+ return output
+
+ # force session to reinitialize
+ def relink_session():
+ for r in ["r1", "r2"]:
+ tgen.gears[r].vtysh_cmd("clear ip nhrp cache")
+ tgen.net[r].cmd("ip l del {}-gre0".format(r));
+ _populate_iface();
+
+ @retry(retry_timeout=40, initial_wait=5)
+ def verify_same_password():
+ output = ping_helper()
+ if "100 packets transmitted, 100 received" not in output:
+ assertmsg = "expected ping IPv4 from R1 to R2 should be ok"
+ assert 0, assertmsg
+ else:
+ logger.info("Check Ping IPv4 from R1 to R2 OK")
+
+ @retry(retry_timeout=40, initial_wait=5)
+ def verify_mismatched_password():
+ output = ping_helper()
+ if "Network is unreachable" not in output:
+ assertmsg = "expected ping IPv4 from R1 to R2 - should be down"
+ assert 0, assertmsg
+ else:
+ logger.info("Check Ping IPv4 from R1 to R2 missing - OK")
+
+ ### Passwords are the same
+ logger.info("Check Ping IPv4 from R1 to R2 = 10.255.255.2")
+ verify_same_password()
+
+ ### Passwords are different
+ logger.info("Modify password and send ping again, should drop")
+ hubrouter.vtysh_cmd("""
+ configure
+ interface r2-gre0
+ ip nhrp authentication secret12
+ """)
+ relink_session()
+ verify_mismatched_password()
+
+ ### Passwords are the same - again
+ logger.info("Recover password and verify conectivity is back")
+ hubrouter.vtysh_cmd("""
+ configure
+ interface r2-gre0
+ ip nhrp authentication secret
+ """)
+ relink_session()
+ verify_same_password()
def test_route_install():
"Test use of NHRP routes by other protocols (sharpd here)."
diff --git a/tests/topotests/ospf_p2mp/test_ospf_p2mp_broadcast.py b/tests/topotests/ospf_p2mp/test_ospf_p2mp_broadcast.py
index 1f0f87959a..791d7cb09b 100644
--- a/tests/topotests/ospf_p2mp/test_ospf_p2mp_broadcast.py
+++ b/tests/topotests/ospf_p2mp/test_ospf_p2mp_broadcast.py
@@ -140,22 +140,6 @@ def verify_p2mp_interface(tgen, router, nbr_cnt, nbr_adj_cnt, nbr_filter):
"interfaces": {
"r1-eth0": {
"ospfEnabled": True,
- "interfaceIp": {
- "10.1.0.1": {
- "ipAddress": "10.1.0.1",
- "ipAddressPrefixlen": 24,
- "ospfIfType": "Broadcast",
- "routerId": "1.1.1.1",
- "networkType": "POINTOMULTIPOINT",
- "cost": 10,
- "state": "Point-To-Point",
- "nbrCount": nbr_cnt,
- "nbrAdjacentCount": nbr_adj_cnt,
- "prefixSuppression": False,
- "p2mpDelayReflood": False,
- "nbrFilterPrefixList": nbr_filter,
- }
- },
"ipAddress": "10.1.0.1",
"ipAddressPrefixlen": 24,
"ospfIfType": "Broadcast",
@@ -201,17 +185,6 @@ def verify_non_p2mp_interface(tgen):
"interfaces": {
"r1-eth0": {
"ospfEnabled": True,
- "interfaceIp": {
- "10.1.0.1": {
- "ipAddress": "10.1.0.1",
- "ipAddressPrefixlen": 24,
- "ospfIfType": "Broadcast",
- "routerId": "1.1.1.1",
- "networkType": "BROADCAST",
- "cost": 10,
- "prefixSuppression": False,
- }
- },
"ipAddress": "10.1.0.1",
"ipAddressPrefixlen": 24,
"ospfIfType": "Broadcast",
diff --git a/tests/topotests/ospf_p2mp/test_ospf_p2mp_non_broadcast.py b/tests/topotests/ospf_p2mp/test_ospf_p2mp_non_broadcast.py
index 175dca74e7..f100aa624a 100644
--- a/tests/topotests/ospf_p2mp/test_ospf_p2mp_non_broadcast.py
+++ b/tests/topotests/ospf_p2mp/test_ospf_p2mp_non_broadcast.py
@@ -144,22 +144,6 @@ def verify_p2mp_interface(tgen, router, nbr_cnt, nbr_adj_cnt, non_broadcast):
"interfaces": {
"r1-eth0": {
"ospfEnabled": True,
- "interfaceIp": {
- "10.1.0.1": {
- "ipAddress": "10.1.0.1",
- "ipAddressPrefixlen": 24,
- "ospfIfType": "Broadcast",
- "routerId": "1.1.1.1",
- "networkType": "POINTOMULTIPOINT",
- "cost": 10,
- "state": "Point-To-Point",
- "nbrCount": nbr_cnt,
- "nbrAdjacentCount": nbr_adj_cnt,
- "prefixSuppression": False,
- "p2mpDelayReflood": False,
- "p2mpNonBroadcast": non_broadcast,
- }
- },
"ipAddress": "10.1.0.1",
"ipAddressPrefixlen": 24,
"ospfIfType": "Broadcast",
diff --git a/yang/frr-isisd.yang b/yang/frr-isisd.yang
index d1a08fa976..60914b0be9 100644
--- a/yang/frr-isisd.yang
+++ b/yang/frr-isisd.yang
@@ -685,7 +685,7 @@ module frr-isisd {
type uint32 {
range "0..16777215";
}
- must ". < 64 or /frr-isisd:isis/instance[area-tag = current()/../../area-tag]/metric-style = 'wide' or not(/frr-isisd:isis/instance[area-tag = current()/../../area-tag]/metric-style)";
+ must ". < 64 or not(/frr-isisd:isis/instance[area-tag = current()/../../area-tag]/metric-style) or /frr-isisd:isis/instance[area-tag = current()/../../area-tag]/metric-style != 'narrow'";
default "10";
description
"Default level-1 metric for this IS-IS circuit.";
@@ -695,7 +695,7 @@ module frr-isisd {
type uint32 {
range "0..16777215";
}
- must ". < 64 or /frr-isisd:isis/instance[area-tag = current()/../../area-tag]/metric-style = 'wide' or not(/frr-isisd:isis/instance[area-tag = current()/../../area-tag]/metric-style)";
+ must ". < 64 or not(/frr-isisd:isis/instance[area-tag = current()/../../area-tag]/metric-style) or /frr-isisd:isis/instance[area-tag = current()/../../area-tag]/metric-style != 'narrow'";
default "10";
description
"Default level-2 metric for this IS-IS circuit.";
diff --git a/zebra/dplane_fpm_nl.c b/zebra/dplane_fpm_nl.c
index 9ad92d6269..28c481d1d8 100644
--- a/zebra/dplane_fpm_nl.c
+++ b/zebra/dplane_fpm_nl.c
@@ -136,8 +136,6 @@ struct fpm_nl_ctx {
/* Amount of data plane context processed. */
_Atomic uint32_t dplane_contexts;
- /* Amount of data plane contexts enqueued. */
- _Atomic uint32_t ctxqueue_len;
/* Peak amount of data plane contexts enqueued. */
_Atomic uint32_t ctxqueue_len_peak;
@@ -399,6 +397,12 @@ DEFUN(fpm_show_counters, fpm_show_counters_cmd,
FPM_STR
"FPM statistic counters\n")
{
+ uint32_t curr_queue_len;
+
+ frr_with_mutex (&gfnc->ctxqueue_mutex) {
+ curr_queue_len = dplane_ctx_queue_count(&gfnc->ctxqueue);
+ }
+
vty_out(vty, "%30s\n%30s\n", "FPM counters", "============");
#define SHOW_COUNTER(label, counter) \
@@ -412,8 +416,7 @@ DEFUN(fpm_show_counters, fpm_show_counters_cmd,
SHOW_COUNTER("Connection errors", gfnc->counters.connection_errors);
SHOW_COUNTER("Data plane items processed",
gfnc->counters.dplane_contexts);
- SHOW_COUNTER("Data plane items enqueued",
- gfnc->counters.ctxqueue_len);
+ SHOW_COUNTER("Data plane items enqueued", curr_queue_len);
SHOW_COUNTER("Data plane items queue peak",
gfnc->counters.ctxqueue_len_peak);
SHOW_COUNTER("Buffer full hits", gfnc->counters.buffer_full);
@@ -432,6 +435,12 @@ DEFUN(fpm_show_counters_json, fpm_show_counters_json_cmd,
"FPM statistic counters\n"
JSON_STR)
{
+ uint32_t curr_queue_len;
+
+ frr_with_mutex (&gfnc->ctxqueue_mutex) {
+ curr_queue_len = dplane_ctx_queue_count(&gfnc->ctxqueue);
+ }
+
struct json_object *jo;
jo = json_object_new_object();
@@ -445,8 +454,7 @@ DEFUN(fpm_show_counters_json, fpm_show_counters_json_cmd,
gfnc->counters.connection_errors);
json_object_int_add(jo, "data-plane-contexts",
gfnc->counters.dplane_contexts);
- json_object_int_add(jo, "data-plane-contexts-queue",
- gfnc->counters.ctxqueue_len);
+ json_object_int_add(jo, "data-plane-contexts-queue", curr_queue_len);
json_object_int_add(jo, "data-plane-contexts-queue-peak",
gfnc->counters.ctxqueue_len_peak);
json_object_int_add(jo, "buffer-full-hits", gfnc->counters.buffer_full);
@@ -1495,8 +1503,6 @@ static void fpm_process_queue(struct event *t)
/* Account the processed entries. */
processed_contexts++;
- atomic_fetch_sub_explicit(&fnc->counters.ctxqueue_len, 1,
- memory_order_relaxed);
dplane_ctx_set_status(ctx, ZEBRA_DPLANE_REQUEST_SUCCESS);
dplane_provider_enqueue_out_ctx(fnc->prov, ctx);
@@ -1670,7 +1676,7 @@ static int fpm_nl_process(struct zebra_dplane_provider *prov)
struct zebra_dplane_ctx *ctx;
struct fpm_nl_ctx *fnc;
int counter, limit;
- uint64_t cur_queue, peak_queue = 0, stored_peak_queue;
+ uint64_t cur_queue = 0, peak_queue = 0, stored_peak_queue;
fnc = dplane_provider_get_data(prov);
limit = dplane_provider_get_work_limit(prov);
@@ -1684,20 +1690,12 @@ static int fpm_nl_process(struct zebra_dplane_provider *prov)
* anyway.
*/
if (fnc->socket != -1 && fnc->connecting == false) {
- /*
- * Update the number of queued contexts *before*
- * enqueueing, to ensure counter consistency.
- */
- atomic_fetch_add_explicit(&fnc->counters.ctxqueue_len,
- 1, memory_order_relaxed);
-
frr_with_mutex (&fnc->ctxqueue_mutex) {
dplane_ctx_enqueue_tail(&fnc->ctxqueue, ctx);
+ cur_queue =
+ dplane_ctx_queue_count(&fnc->ctxqueue);
}
- cur_queue = atomic_load_explicit(
- &fnc->counters.ctxqueue_len,
- memory_order_relaxed);
if (peak_queue < cur_queue)
peak_queue = cur_queue;
continue;
@@ -1714,9 +1712,7 @@ static int fpm_nl_process(struct zebra_dplane_provider *prov)
atomic_store_explicit(&fnc->counters.ctxqueue_len_peak,
peak_queue, memory_order_relaxed);
- if (atomic_load_explicit(&fnc->counters.ctxqueue_len,
- memory_order_relaxed)
- > 0)
+ if (cur_queue > 0)
event_add_event(fnc->fthread->master, fpm_process_queue, fnc, 0,
&fnc->t_dequeue);
diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c
index 06b34da209..ee48a571b8 100644
--- a/zebra/zebra_dplane.c
+++ b/zebra/zebra_dplane.c
@@ -969,6 +969,11 @@ struct zebra_dplane_ctx *dplane_ctx_dequeue(struct dplane_ctx_list_head *q)
return ctx;
}
+uint32_t dplane_ctx_queue_count(struct dplane_ctx_list_head *q)
+{
+ return dplane_ctx_list_count(q);
+}
+
/*
* Accessors for information from the context object
*/
diff --git a/zebra/zebra_dplane.h b/zebra/zebra_dplane.h
index 060b1c8b9e..0e9a8bfb99 100644
--- a/zebra/zebra_dplane.h
+++ b/zebra/zebra_dplane.h
@@ -323,6 +323,8 @@ struct zebra_dplane_ctx *dplane_ctx_get_head(struct dplane_ctx_list_head *q);
/* Init a list of contexts */
void dplane_ctx_q_init(struct dplane_ctx_list_head *q);
+uint32_t dplane_ctx_queue_count(struct dplane_ctx_list_head *q);
+
/*
* Accessors for information from the context object
*/
diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c
index 1246e4dba2..55920102bb 100644
--- a/zebra/zebra_nhg.c
+++ b/zebra/zebra_nhg.c
@@ -1747,6 +1747,12 @@ static struct nexthop *nexthop_set_resolved(afi_t afi,
SET_FLAG(resolved_hop->flags, NEXTHOP_FLAG_ACTIVE);
resolved_hop->vrf_id = nexthop->vrf_id;
+
+ /* Using weighted ECMP, we should respect the weight and use
+ * the same value for non-recursive next-hop.
+ */
+ resolved_hop->weight = nexthop->weight;
+
switch (newhop->type) {
case NEXTHOP_TYPE_IPV4:
case NEXTHOP_TYPE_IPV4_IFINDEX: