Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bgpd: add json support for BGP L3NHG values #16631

Merged
merged 1 commit into from
Aug 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 56 additions & 20 deletions bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -10568,8 +10568,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
vty_out(vty, "\n");


if (path->extra && path->extra->vrfleak &&
path->extra->vrfleak->parent && !json_paths) {
if (path->extra && path->extra->vrfleak && path->extra->vrfleak->parent) {
struct bgp_path_info *parent_ri;
struct bgp_dest *dest, *pdest;

Expand All @@ -10579,31 +10578,68 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
if (dest && dest->pdest) {
pdest = dest->pdest;
if (is_pi_family_evpn(parent_ri)) {
vty_out(vty, " Imported from ");
vty_out(vty, BGP_RD_AS_FORMAT(bgp->asnotation),
(struct prefix_rd *)bgp_dest_get_prefix(
pdest));
vty_out(vty, ":%pFX, VNI %s",
(struct prefix_evpn *)
bgp_dest_get_prefix(dest),
vni_buf);
if (CHECK_FLAG(attr->es_flags, ATTR_ES_L3_NHG))
if (json_paths) {
json_object_string_addf(
json_path, "importedFrom",
BGP_RD_AS_FORMAT(bgp->asnotation),
(struct prefix_rd *)
bgp_dest_get_prefix(
pdest));
if (safi != SAFI_EVPN)
json_object_string_add(json_path,
"vni",
vni_buf);
} else {
vty_out(vty, " Imported from ");
vty_out(vty,
BGP_RD_AS_FORMAT(bgp->asnotation),
(struct prefix_rd *)
bgp_dest_get_prefix(
pdest));
vty_out(vty, ":%pFX, VNI %s",
ton31337 marked this conversation as resolved.
Show resolved Hide resolved
(struct prefix_evpn *)
bgp_dest_get_prefix(dest),
vni_buf);
}
if (CHECK_FLAG(attr->es_flags, ATTR_ES_L3_NHG) &&
!json_paths) {
vty_out(vty, ", L3NHG %s",
CHECK_FLAG(
attr->es_flags,
ATTR_ES_L3_NHG_ACTIVE)
? "active"
: "inactive");
vty_out(vty, "\n");

vty_out(vty, "\n");
} else if (json_paths) {
json_object_boolean_add(
json_path, "l3nhg",
CHECK_FLAG(attr->es_flags,
ATTR_ES_L3_NHG));
json_object_boolean_add(
json_path, "l3nhgActive",
CHECK_FLAG(attr->es_flags,
ATTR_ES_L3_NHG_ACTIVE));
}
} else {
vty_out(vty, " Imported from ");
vty_out(vty, BGP_RD_AS_FORMAT(bgp->asnotation),
(struct prefix_rd *)bgp_dest_get_prefix(
pdest));
vty_out(vty, ":%pFX\n",
(struct prefix_evpn *)
bgp_dest_get_prefix(dest));
if (json_paths) {
json_object_string_addf(
json_path, "importedFrom",
BGP_RD_AS_FORMAT(bgp->asnotation),
(struct prefix_rd *)
bgp_dest_get_prefix(
pdest));
} else {
vty_out(vty, " Imported from ");
vty_out(vty,
BGP_RD_AS_FORMAT(bgp->asnotation),
(struct prefix_rd *)
bgp_dest_get_prefix(
pdest));
vty_out(vty, ":%pFX\n",
(struct prefix_evpn *)
bgp_dest_get_prefix(
dest));
}
}
}
}
Expand Down
Loading