/* Ethernet-VPN Packet and vty Processing File
- Copyright (C) 2017 6WIND
-
-This file is part of FRRouting
-
-FRRouting is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 2, or (at your option) any
-later version.
-
-FRRouting is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with FRRouting; see the file COPYING. If not, write to the Free
-Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA. */
+ * Copyright (C) 2017 6WIND
+ *
+ * This file is part of FRRouting
+ *
+ * FRRouting is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * FRRouting is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
#include <zebra.h>
#include "command.h"
struct bgp_info *ri;
int rd_header;
int header = 1;
- char v4_header[] =
- " Network Next Hop Metric LocPrf Weight Path%s";
- char v4_header_tag[] =
- " Network Next Hop In tag/Out tag%s";
- char v4_header_overlay[] =
- " Network Next Hop EthTag Overlay Index RouterMac%s";
unsigned long output_count = 0;
unsigned long total_count = 0;
bgp = bgp_get_default();
if (bgp == NULL) {
if (!use_json)
- vty_out(vty, "No BGP process is configured%s",
- VTY_NEWLINE);
+ vty_out (vty,"No BGP process is configured\n");
return CMD_WARNING;
}
} else {
if (option ==
SHOW_DISPLAY_TAGS)
- vty_out(vty,
- v4_header_tag,
- VTY_NEWLINE);
+ vty_out(vty, V4_HEADER_TAG);
else if (option ==
SHOW_DISPLAY_OVERLAY)
- vty_out(vty,
- v4_header_overlay,
- VTY_NEWLINE);
+ vty_out(vty, V4_HEADER_OVERLAY);
else {
- vty_out(vty,
- "BGP table version is 0, local router ID is %s%s",
- inet_ntoa
- (bgp->
- router_id),
- VTY_NEWLINE);
- vty_out(vty,
- "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal%s",
- VTY_NEWLINE);
- vty_out(vty,
- "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s",
- VTY_NEWLINE,
- VTY_NEWLINE);
- vty_out(vty,
- v4_header,
- VTY_NEWLINE);
+ vty_out (vty,
+ "BGP table version is 0, local router ID is %s\n",
+ inet_ntoa(bgp->router_id));
+ vty_out (vty,
+ "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal\n");
+ vty_out (vty,
+ "Origin codes: i - IGP, e - EGP, ? - incomplete%s\n",
+ VTYNL);
+ vty_out(vty, V4_HEADER);
}
}
header = 0;
ip),
rd_ip.
val);
- vty_out(vty, "%s",
- VTY_NEWLINE);
+ vty_out (vty, "\n\n");
}
rd_header = 0;
}
}
}
if (output_count == 0)
- vty_out(vty, "No prefixes displayed, %ld exist%s", total_count,
- VTY_NEWLINE);
+ vty_out (vty, "No prefixes displayed, %ld exist\n",
+ total_count);
else
- vty_out(vty, "%sDisplayed %ld out of %ld total prefixes%s",
- VTY_NEWLINE, output_count, total_count, VTY_NEWLINE);
+ vty_out (vty, "%sDisplayed %ld out of %ld total prefixes\n",
+ VTYNL, output_count, total_count);
return CMD_SUCCESS;
}
ret = str2prefix_rd(argv[idx_ext_community]->arg, &prd);
if (!ret) {
- vty_out(vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
+ vty_out (vty, "%% Malformed Route Distinguisher\n");
return CMD_WARNING;
}
return bgp_show_ethernet_vpn(vty, &prd, bgp_show_type_normal, NULL, 0,
ret = str2prefix_rd(argv[idx_ext_community]->arg, &prd);
if (!ret) {
- vty_out(vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
+ vty_out (vty, "%% Malformed Route Distinguisher\n");
return CMD_WARNING;
}
return bgp_show_ethernet_vpn(vty, &prd, bgp_show_type_normal, NULL, 1,
json_no = json_object_new_object();
json_object_string_add(json_no, "warning",
"Malformed address");
- vty_out(vty, "%s%s",
- json_object_to_json_string(json_no),
- VTY_NEWLINE);
+ vty_out (vty, "%s\n",
+ json_object_to_json_string(json_no));
json_object_free(json_no);
} else
- vty_out(vty, "Malformed address: %s%s",
- argv[idx_ipv4]->arg, VTY_NEWLINE);
+ vty_out (vty, "Malformed address: %s\n",
+ argv[idx_ipv4]->arg);
return CMD_WARNING;
}
json_no = json_object_new_object();
json_object_string_add(json_no, "warning",
"No such neighbor or address family");
- vty_out(vty, "%s%s",
- json_object_to_json_string(json_no),
- VTY_NEWLINE);
+ vty_out (vty, "%s\n",
+ json_object_to_json_string(json_no));
json_object_free(json_no);
} else
- vty_out(vty, "%% No such neighbor or address family%s",
- VTY_NEWLINE);
+ vty_out (vty,
+ "%% No such neighbor or address family\n");
return CMD_WARNING;
}
json_no = json_object_new_object();
json_object_string_add(json_no, "warning",
"Malformed Route Distinguisher");
- vty_out(vty, "%s%s",
- json_object_to_json_string(json_no),
- VTY_NEWLINE);
+ vty_out (vty, "%s\n",
+ json_object_to_json_string(json_no));
json_object_free(json_no);
} else
- vty_out(vty, "%% Malformed Route Distinguisher%s",
- VTY_NEWLINE);
+ vty_out (vty,"%% Malformed Route Distinguisher\n");
return CMD_WARNING;
}
json_no = json_object_new_object();
json_object_string_add(json_no, "warning",
"Malformed address");
- vty_out(vty, "%s%s",
- json_object_to_json_string(json_no),
- VTY_NEWLINE);
+ vty_out (vty, "%s\n",
+ json_object_to_json_string(json_no));
json_object_free(json_no);
} else
- vty_out(vty, "Malformed address: %s%s",
- argv[idx_ext_community]->arg, VTY_NEWLINE);
+ vty_out (vty, "Malformed address: %s\n",
+ argv[idx_ext_community]->arg);
return CMD_WARNING;
}
json_no = json_object_new_object();
json_object_string_add(json_no, "warning",
"No such neighbor or address family");
- vty_out(vty, "%s%s",
- json_object_to_json_string(json_no),
- VTY_NEWLINE);
+ vty_out (vty, "%s\n",
+ json_object_to_json_string(json_no));
json_object_free(json_no);
} else
- vty_out(vty, "%% No such neighbor or address family%s",
- VTY_NEWLINE);
+ vty_out (vty,
+ "%% No such neighbor or address family\n");
return CMD_WARNING;
}
json_no = json_object_new_object();
json_object_string_add(json_no, "warning",
"Malformed address");
- vty_out(vty, "%s%s",
- json_object_to_json_string(json_no),
- VTY_NEWLINE);
+ vty_out (vty, "%s\n",
+ json_object_to_json_string(json_no));
json_object_free(json_no);
} else
- vty_out(vty, "Malformed address: %s%s",
- argv[idx_ipv4]->arg, VTY_NEWLINE);
+ vty_out (vty, "Malformed address: %s\n",
+ argv[idx_ipv4]->arg);
return CMD_WARNING;
}
peer = peer_lookup(NULL, &su);
json_no = json_object_new_object();
json_object_string_add(json_no, "warning",
"No such neighbor or address family");
- vty_out(vty, "%s%s",
- json_object_to_json_string(json_no),
- VTY_NEWLINE);
+ vty_out (vty, "%s\n",
+ json_object_to_json_string(json_no));
json_object_free(json_no);
} else
- vty_out(vty, "%% No such neighbor or address family%s",
- VTY_NEWLINE);
+ vty_out (vty,
+ "%% No such neighbor or address family\n");
return CMD_WARNING;
}
json_no = json_object_new_object();
json_object_string_add(json_no, "warning",
"Malformed address");
- vty_out(vty, "%s%s",
- json_object_to_json_string(json_no),
- VTY_NEWLINE);
+ vty_out (vty, "%s\n",
+ json_object_to_json_string(json_no));
json_object_free(json_no);
} else
- vty_out(vty, "Malformed address: %s%s",
- argv[idx_ext_community]->arg, VTY_NEWLINE);
+ vty_out (vty, "Malformed address: %s\n",
+ argv[idx_ext_community]->arg);
return CMD_WARNING;
}
peer = peer_lookup(NULL, &su);
json_no = json_object_new_object();
json_object_string_add(json_no, "warning",
"No such neighbor or address family");
- vty_out(vty, "%s%s",
- json_object_to_json_string(json_no),
- VTY_NEWLINE);
+ vty_out (vty, "%s\n",
+ json_object_to_json_string(json_no));
json_object_free(json_no);
} else
- vty_out(vty, "%% No such neighbor or address family%s",
- VTY_NEWLINE);
+ vty_out (vty,
+ "%% No such neighbor or address family\n");
return CMD_WARNING;
}
json_no = json_object_new_object();
json_object_string_add(json_no, "warning",
"Malformed Route Distinguisher");
- vty_out(vty, "%s%s",
- json_object_to_json_string(json_no),
- VTY_NEWLINE);
+ vty_out (vty, "%s\n",
+ json_object_to_json_string(json_no));
json_object_free(json_no);
} else
- vty_out(vty, "%% Malformed Route Distinguisher%s",
- VTY_NEWLINE);
+ vty_out (vty,"%% Malformed Route Distinguisher\n");
return CMD_WARNING;
}
ret = str2prefix_rd(argv[idx_ext_community]->arg, &prd);
if (!ret) {
- vty_out(vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
+ vty_out (vty, "%% Malformed Route Distinguisher\n");
return CMD_WARNING;
}
return bgp_show_ethernet_vpn(vty, &prd, bgp_show_type_normal, NULL,
int idx_ethtag = 5;
int idx_routermac = 13;
int idx_rmap = 15;
- return bgp_static_set_safi(SAFI_EVPN, vty,
+ return bgp_static_set_safi(AFI_L2VPN, SAFI_EVPN, vty,
argv[idx_ipv4_prefixlen]->arg,
argv[idx_ext_community]->arg,
argv[idx_word]->arg,
int idx_ethtag = 6;
int idx_esi = 10;
int idx_gwip = 12;
- return bgp_static_unset_safi(SAFI_EVPN, vty,
+ return bgp_static_unset_safi(AFI_L2VPN, SAFI_EVPN, vty,
argv[idx_ipv4_prefixlen]->arg,
argv[idx_ext_community]->arg,
argv[idx_label]->arg, EVPN_IP_PREFIX,