summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_evpn.c28
-rw-r--r--bgpd/bgp_evpn_vty.c33
-rw-r--r--bgpd/bgp_open.c10
-rw-r--r--bgpd/bgp_packet.c8
-rw-r--r--bgpd/bgp_route.c39
-rw-r--r--bgpd/bgp_route.h3
-rw-r--r--isisd/isis_te.c2
-rwxr-xr-xtests/topotests/conftest.py2
-rw-r--r--tests/topotests/example_munet/r1/frr.conf2
-rw-r--r--tests/topotests/example_munet/r2/frr.conf4
-rw-r--r--tests/topotests/example_munet/r3/frr.conf2
-rw-r--r--tests/topotests/example_munet/test_munet.py18
-rw-r--r--tests/topotests/kinds.yaml3
-rw-r--r--tests/topotests/pytest.ini2
-rwxr-xr-xtools/frr-reload.py6
15 files changed, 94 insertions, 68 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index cb5c898315..db93640635 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -2124,22 +2124,18 @@ static void evpn_zebra_reinstall_best_route(struct bgp *bgp,
}
}
- if (curr_select && curr_select->type == ZEBRA_ROUTE_BGP
- && (curr_select->sub_type == BGP_ROUTE_IMPORTED ||
- bgp_evpn_attr_is_sync(curr_select->attr)))
- if (curr_select && curr_select->type == ZEBRA_ROUTE_BGP &&
- (curr_select->sub_type == BGP_ROUTE_IMPORTED ||
- bgp_evpn_attr_is_sync(curr_select->attr))) {
- if (CHECK_FLAG(bgp->flags, BGP_FLAG_DELETE_IN_PROGRESS))
- evpn_zebra_install(bgp, vpn,
- (const struct prefix_evpn *)
- bgp_dest_get_prefix(
- dest),
- curr_select);
- else
- bgp_zebra_route_install(dest, curr_select, bgp,
- true, vpn, false);
- }
+ if (curr_select && curr_select->type == ZEBRA_ROUTE_BGP &&
+ (curr_select->sub_type == BGP_ROUTE_IMPORTED ||
+ bgp_evpn_attr_is_sync(curr_select->attr))) {
+ if (CHECK_FLAG(bgp->flags, BGP_FLAG_DELETE_IN_PROGRESS))
+ evpn_zebra_install(bgp, vpn,
+ (const struct prefix_evpn *)
+ bgp_dest_get_prefix(dest),
+ curr_select);
+ else
+ bgp_zebra_route_install(dest, curr_select, bgp, true,
+ vpn, false);
+ }
}
/*
diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c
index c28cdb4a65..0a5e6a773b 100644
--- a/bgpd/bgp_evpn_vty.c
+++ b/bgpd/bgp_evpn_vty.c
@@ -2561,7 +2561,7 @@ static void evpn_show_route_vni_multicast(struct vty *vty, struct bgp *bgp,
/* Prefix and num paths displayed once per prefix. */
route_vty_out_detail_header(vty, bgp, dest, bgp_dest_get_prefix(dest),
- NULL, afi, safi, json, false);
+ NULL, afi, safi, json, false, true);
/* Display each path for this prefix. */
for (pi = bgp_dest_get_bgp_path_info(dest); pi; pi = pi->next) {
@@ -2663,7 +2663,7 @@ static void evpn_show_route_vni_macip(struct vty *vty, struct bgp *bgp,
/* Prefix and num paths displayed once per prefix. */
route_vty_out_detail_header(vty, bgp, dest, (struct prefix *)&p, NULL,
- afi, safi, json, false);
+ afi, safi, json, false, true);
evp = (const struct prefix_evpn *)bgp_dest_get_prefix(dest);
@@ -2798,7 +2798,7 @@ static void evpn_show_route_rd_macip(struct vty *vty, struct bgp *bgp,
/* Prefix and num paths displayed once per prefix. */
route_vty_out_detail_header(vty, bgp, dest, bgp_dest_get_prefix(dest),
- prd, afi, safi, json, false);
+ prd, afi, safi, json, false, false);
if (json)
json_paths = json_object_new_array();
@@ -2905,9 +2905,10 @@ static void evpn_show_route_rd(struct vty *vty, struct bgp *bgp,
}
/* Prefix and num paths displayed once per prefix. */
- route_vty_out_detail_header(
- vty, bgp, dest, bgp_dest_get_prefix(dest), prd,
- afi, safi, json_prefix, false);
+ route_vty_out_detail_header(vty, bgp, dest,
+ bgp_dest_get_prefix(dest),
+ prd, afi, safi, json_prefix,
+ false, false);
prefix_cnt++;
}
@@ -3042,9 +3043,10 @@ static void evpn_show_route_rd_all_macip(struct vty *vty, struct bgp *bgp,
p->prefixlen);
} else
/* Prefix and num paths displayed once per prefix. */
- route_vty_out_detail_header(
- vty, bgp, dest, p, (struct prefix_rd *)rd_destp,
- AFI_L2VPN, SAFI_EVPN, json_prefix, false);
+ route_vty_out_detail_header(vty, bgp, dest, p,
+ (struct prefix_rd *)rd_destp,
+ AFI_L2VPN, SAFI_EVPN,
+ json_prefix, false, false);
/* For EVPN, the prefix is displayed for each path (to
* fit in with code that already exists).
@@ -3197,11 +3199,14 @@ static void evpn_show_all_routes(struct vty *vty, struct bgp *bgp, int type,
/* Prefix and num paths displayed once per prefix. */
if (detail)
- route_vty_out_detail_header(
- vty, bgp, dest,
- bgp_dest_get_prefix(dest),
- (struct prefix_rd *)rd_destp, AFI_L2VPN,
- SAFI_EVPN, json_prefix, false);
+ route_vty_out_detail_header(vty, bgp, dest,
+ bgp_dest_get_prefix(
+ dest),
+ (struct prefix_rd *)
+ rd_destp,
+ AFI_L2VPN, SAFI_EVPN,
+ json_prefix, false,
+ false);
/* For EVPN, the prefix is displayed for each path (to
* fit in
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
index 945076709c..6451c7cf38 100644
--- a/bgpd/bgp_open.c
+++ b/bgpd/bgp_open.c
@@ -1374,7 +1374,7 @@ int bgp_open_option_parse(struct peer *peer, uint16_t length,
* Check that we can read the opt_type and fetch it
*/
if (STREAM_READABLE(s) < 1) {
- zlog_info("%s Option length error", peer->host);
+ zlog_err("%s Option length error", peer->host);
bgp_notify_send(peer->connection, BGP_NOTIFY_OPEN_ERR,
BGP_NOTIFY_OPEN_MALFORMED_ATTR);
return -1;
@@ -1387,7 +1387,7 @@ int bgp_open_option_parse(struct peer *peer, uint16_t length,
*/
if (BGP_OPEN_EXT_OPT_PARAMS_CAPABLE(peer)) {
if (STREAM_READABLE(s) < 2) {
- zlog_info("%s Option length error", peer->host);
+ zlog_err("%s Option length error", peer->host);
bgp_notify_send(peer->connection,
BGP_NOTIFY_OPEN_ERR,
BGP_NOTIFY_OPEN_MALFORMED_ATTR);
@@ -1397,7 +1397,7 @@ int bgp_open_option_parse(struct peer *peer, uint16_t length,
opt_length = stream_getw(s);
} else {
if (STREAM_READABLE(s) < 1) {
- zlog_info("%s Option length error", peer->host);
+ zlog_err("%s Option length error", peer->host);
bgp_notify_send(peer->connection,
BGP_NOTIFY_OPEN_ERR,
BGP_NOTIFY_OPEN_MALFORMED_ATTR);
@@ -1409,8 +1409,8 @@ int bgp_open_option_parse(struct peer *peer, uint16_t length,
/* Option length check. */
if (STREAM_READABLE(s) < opt_length) {
- zlog_info("%s Option length error (%d)", peer->host,
- opt_length);
+ zlog_err("%s Option length error (%d)", peer->host,
+ opt_length);
bgp_notify_send(peer->connection, BGP_NOTIFY_OPEN_ERR,
BGP_NOTIFY_OPEN_MALFORMED_ATTR);
return -1;
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 2a2c9bdba9..fa03f1d21d 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -1116,10 +1116,10 @@ void bgp_route_refresh_send(struct peer *peer, afi_t afi, safi_t safi,
s = stream_new(peer->max_packet_size);
/* Make BGP update packet. */
- if (CHECK_FLAG(peer->cap, PEER_CAP_REFRESH_RCV))
- bgp_packet_set_marker(s, BGP_MSG_ROUTE_REFRESH_NEW);
- else
- bgp_packet_set_marker(s, BGP_MSG_ROUTE_REFRESH_OLD);
+ if (!CHECK_FLAG(peer->cap, PEER_CAP_REFRESH_RCV))
+ return;
+
+ bgp_packet_set_marker(s, BGP_MSG_ROUTE_REFRESH_NEW);
/* Encode Route Refresh message. */
stream_putw(s, pkt_afi);
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 3ff7dbc070..8fcbcb5775 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -11918,10 +11918,9 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t sa
if (!use_json)
route_vty_out_detail_header(
vty, bgp, dest,
- bgp_dest_get_prefix(
- dest),
+ bgp_dest_get_prefix(dest),
prd, table->afi, safi,
- NULL, false);
+ NULL, false, false);
route_vty_out_detail(
vty, bgp, dest, dest_p, pi,
@@ -11994,10 +11993,12 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, afi_t afi, safi_t sa
prd = bgp_rd_from_dest(dest, safi);
- route_vty_out_detail_header(
- vty, bgp, dest,
- bgp_dest_get_prefix(dest), prd,
- table->afi, safi, json_paths, true);
+ route_vty_out_detail_header(vty, bgp, dest,
+ bgp_dest_get_prefix(
+ dest),
+ prd, table->afi,
+ safi, json_paths,
+ true, false);
vty_out(vty, "\"paths\": ");
json_detail_header_used = true;
@@ -12203,7 +12204,7 @@ void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp,
struct bgp_dest *dest, const struct prefix *p,
const struct prefix_rd *prd, afi_t afi,
safi_t safi, json_object *json,
- bool incremental_print)
+ bool incremental_print, bool local_table)
{
struct bgp_path_info *pi;
struct peer *peer;
@@ -12421,8 +12422,14 @@ void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp,
json_object_object_add(json, "advertisedTo",
json_adv_to);
} else {
- if (!json && first)
- vty_out(vty, " Not advertised to any peer");
+ if (!json && first) {
+ if (!local_table)
+ vty_out(vty,
+ " Not advertised to any peer");
+ else
+ vty_out(vty,
+ " Local BGP table not advertised");
+ }
vty_out(vty, "\n");
}
}
@@ -12461,10 +12468,10 @@ static void bgp_show_path_info(const struct prefix_rd *pfx_rd,
}
if (header) {
- route_vty_out_detail_header(
- vty, bgp, bgp_node,
- bgp_dest_get_prefix(bgp_node), pfx_rd, AFI_IP,
- safi, json_header, false);
+ route_vty_out_detail_header(vty, bgp, bgp_node,
+ bgp_dest_get_prefix(bgp_node),
+ pfx_rd, AFI_IP, safi,
+ json_header, false, false);
header = 0;
}
(*display)++;
@@ -12934,7 +12941,7 @@ DEFUN (show_ip_bgp_l2vpn_evpn_statistics,
struct json_object *json_afi_safi = NULL, *json = NULL;
bgp_vty_find_and_parse_afi_safi_bgp(vty, argv, argc, &idx, &afi, &safi,
- &bgp, false);
+ &bgp, uj);
if (!idx)
return CMD_WARNING;
@@ -12972,7 +12979,7 @@ DEFUN(show_ip_bgp_afi_safi_statistics, show_ip_bgp_afi_safi_statistics_cmd,
struct json_object *json_afi_safi = NULL, *json = NULL;
bgp_vty_find_and_parse_afi_safi_bgp(vty, argv, argc, &idx, &afi, &safi,
- &bgp, false);
+ &bgp, uj);
if (!idx)
return CMD_WARNING;
diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h
index b1c8356301..bc3ca4b2f8 100644
--- a/bgpd/bgp_route.h
+++ b/bgpd/bgp_route.h
@@ -903,7 +903,8 @@ extern void route_vty_out_detail_header(struct vty *vty, struct bgp *bgp,
const struct prefix *p,
const struct prefix_rd *prd, afi_t afi,
safi_t safi, json_object *json,
- bool incremental_print);
+ bool incremental_print,
+ bool local_table);
extern void route_vty_out_detail(struct vty *vty, struct bgp *bgp,
struct bgp_dest *bn, const struct prefix *p,
struct bgp_path_info *path, afi_t afi,
diff --git a/isisd/isis_te.c b/isisd/isis_te.c
index a550d59387..c9af39ce5a 100644
--- a/isisd/isis_te.c
+++ b/isisd/isis_te.c
@@ -331,7 +331,7 @@ void isis_link_params_update(struct isis_circuit *circuit,
return;
/* Sanity Check */
- if ((ifp == NULL) || (circuit->state != C_STATE_UP))
+ if (ifp == NULL)
return;
te_debug("ISIS-TE(%s): Update circuit parameters for interface %s",
diff --git a/tests/topotests/conftest.py b/tests/topotests/conftest.py
index a2315138cc..be28b388ba 100755
--- a/tests/topotests/conftest.py
+++ b/tests/topotests/conftest.py
@@ -32,7 +32,7 @@ from lib import topolog, topotest
try:
# Used by munet native tests
- from munet.testing.fixtures import event_loop, unet # pylint: disable=all # noqa
+ from munet.testing.fixtures import unet # pylint: disable=all # noqa
@pytest.fixture(scope="module")
def rundir_module(pytestconfig):
diff --git a/tests/topotests/example_munet/r1/frr.conf b/tests/topotests/example_munet/r1/frr.conf
index 468bda5e01..692e4ceb47 100644
--- a/tests/topotests/example_munet/r1/frr.conf
+++ b/tests/topotests/example_munet/r1/frr.conf
@@ -4,4 +4,4 @@ service integrated-vtysh-config
interface eth0
ip address 10.0.1.1/24
-ip route 10.0.0.0/8 blackhole
+ip route 10.0.2.0/24 10.0.1.2
diff --git a/tests/topotests/example_munet/r2/frr.conf b/tests/topotests/example_munet/r2/frr.conf
index 77d9892485..da3f15b801 100644
--- a/tests/topotests/example_munet/r2/frr.conf
+++ b/tests/topotests/example_munet/r2/frr.conf
@@ -5,6 +5,4 @@ interface eth0
ip address 10.0.1.2/24
interface eth1
- ip address 10.0.2.2/24
-
-ip route 10.0.0.0/8 blackhole
+ ip address 10.0.2.2/24 \ No newline at end of file
diff --git a/tests/topotests/example_munet/r3/frr.conf b/tests/topotests/example_munet/r3/frr.conf
index e0839e6d8a..84527b34df 100644
--- a/tests/topotests/example_munet/r3/frr.conf
+++ b/tests/topotests/example_munet/r3/frr.conf
@@ -4,4 +4,4 @@ service integrated-vtysh-config
interface eth0
ip address 10.0.2.3/24
-ip route 10.0.0.0/8 blackhole
+ip route 10.0.1.0/24 10.0.2.2 \ No newline at end of file
diff --git a/tests/topotests/example_munet/test_munet.py b/tests/topotests/example_munet/test_munet.py
index 0d9599fa54..71052099c4 100644
--- a/tests/topotests/example_munet/test_munet.py
+++ b/tests/topotests/example_munet/test_munet.py
@@ -5,6 +5,22 @@
#
# Copyright (c) 2023, LabN Consulting, L.L.C.
#
+from munet.testing.util import retry
+
+
+@retry(retry_timeout=10)
+def wait_for_route(r, p):
+ o = r.cmd_raises(f"ip route show {p}")
+ assert p in o
+
+
async def test_native_test(unet):
- o = unet.hosts["r1"].cmd_nostatus("ip addr")
+ r1 = unet.hosts["r1"]
+ o = r1.cmd_nostatus("ip addr")
print(o)
+
+ wait_for_route(r1, "10.0.2.0/24")
+
+ r1.cmd_raises("ping -c1 10.0.1.2")
+ r1.cmd_raises("ping -c1 10.0.2.2")
+ r1.cmd_raises("ping -c1 10.0.2.3")
diff --git a/tests/topotests/kinds.yaml b/tests/topotests/kinds.yaml
index 5f4b61d4b7..20c819c79c 100644
--- a/tests/topotests/kinds.yaml
+++ b/tests/topotests/kinds.yaml
@@ -10,9 +10,10 @@ kinds:
/usr/lib/frr/frrinit.sh stop
volumes:
- "./%NAME%:/etc/frr"
+ - "%RUNDIR%/var.lib.frr:/var/lib/frr"
- "%RUNDIR%/var.log.frr:/var/log/frr"
- "%RUNDIR%/var.run.frr:/var/run/frr"
- - "%RUNDIR%/var.lib.frr:/var/lib/frr"
+ - "%RUNDIR%/var.tmp.frr:/var/tmp/frr"
cap-add:
- SYS_ADMIN
- AUDIT_WRITE
diff --git a/tests/topotests/pytest.ini b/tests/topotests/pytest.ini
index db806fed39..9f33917c6b 100644
--- a/tests/topotests/pytest.ini
+++ b/tests/topotests/pytest.ini
@@ -1,6 +1,8 @@
# Skip pytests example directory
[pytest]
+asyncio_mode = auto
+
# NEEDS_EXABGP_4_2_11_FRR
# asyncio_mode = auto
diff --git a/tools/frr-reload.py b/tools/frr-reload.py
index a88f6b616d..9dae348b8e 100755
--- a/tools/frr-reload.py
+++ b/tools/frr-reload.py
@@ -203,7 +203,7 @@ def get_normalized_es_id(line):
"""
sub_strs = ["evpn mh es-id", "evpn mh es-sys-mac"]
for sub_str in sub_strs:
- obj = re.match(sub_str + " (?P<esi>\S*)", line)
+ obj = re.match(sub_str + r" (?P<esi>\S*)", line)
if obj:
line = "%s %s" % (sub_str, obj.group("esi").lower())
break
@@ -871,7 +871,7 @@ def bgp_delete_nbr_remote_as_line(lines_to_add):
if ctx_keys[0] not in pg_dict:
pg_dict[ctx_keys[0]] = dict()
# find 'neighbor <pg_name> peer-group'
- re_pg = re.match("neighbor (\S+) peer-group$", line)
+ re_pg = re.match(r"neighbor (\S+) peer-group$", line)
if re_pg and re_pg.group(1) not in pg_dict[ctx_keys[0]]:
pg_dict[ctx_keys[0]][re_pg.group(1)] = {
"nbr": list(),
@@ -1066,7 +1066,7 @@ def bgp_delete_move_lines(lines_to_add, lines_to_del):
if ctx_keys[0] not in del_dict:
del_dict[ctx_keys[0]] = dict()
# find 'no neighbor <pg_name> peer-group'
- re_pg = re.match("neighbor (\S+) peer-group$", line)
+ re_pg = re.match(r"neighbor (\S+) peer-group$", line)
if re_pg and re_pg.group(1) not in del_dict[ctx_keys[0]]:
del_dict[ctx_keys[0]][re_pg.group(1)] = list()
found_pg_del_cmd = True