bgpd/zebra: honor tunnel ip change in bgp regardless of vni readiness

Ticket: CM-17014
Review: CCR-6432
Unit-test: Manual

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
This commit is contained in:
Mitesh Kanjariya 2017-07-06 16:33:50 -07:00 committed by Donald Sharp
parent b6938a74e5
commit ddd16ed5f2
3 changed files with 22 additions and 2 deletions

View File

@ -1193,6 +1193,12 @@ static int handle_tunnel_ip_change(struct bgp *bgp, struct bgpevpn *vpn,
{
struct prefix_evpn p;
/* If VNI is not live, we only need to update the originator ip */
if (!is_vni_live(vpn)) {
vpn->originator_ip = originator_ip;
return 0;
}
/* Need to withdraw type-3 route as the originator IP is part
* of the key.
*/
@ -2678,14 +2684,14 @@ int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni,
/* Lookup VNI. If present and no change, exit. */
vpn = bgp_evpn_lookup_vni(bgp, vni);
if (vpn && is_vni_live(vpn)) {
if (vpn) {
if (IPV4_ADDR_SAME(&vpn->originator_ip, &originator_ip))
/* Probably some other param has changed that we don't
* care about. */
return 0;
/* Local tunnel endpoint IP address has changed */
return handle_tunnel_ip_change(bgp, vpn, originator_ip);
handle_tunnel_ip_change(bgp, vpn, originator_ip);
}
/* Create or update as appropriate. */
@ -2699,6 +2705,10 @@ int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni,
}
}
/* if the VNI is live already, there is nothibng more to do */
if (is_vni_live(vpn))
return 0;
/* Mark as "live" */
SET_FLAG(vpn->flags, VNI_FLAG_LIVE);

View File

@ -195,6 +195,8 @@ static void display_vni(struct vty *vty, struct bgpevpn *vpn)
vty_out(vty, " RD: %s\n",
prefix_rd2str(&vpn->prd, buf1, RD_ADDRSTRLEN));
vty_out(vty, " Originator IP: %s\n", inet_ntoa(vpn->originator_ip));
vty_out(vty, " Advertise-gw-macip : %s\n",
vpn->advertise_gw_macip ? "Yes" : "No");
vty_out(vty, " Import Route Target:\n");
for (ALL_LIST_ELEMENTS(vpn->import_rtl, node, nnode, ecom)) {

View File

@ -607,6 +607,8 @@ static void zvni_print(zebra_vni_t *zvni, void **ctxt)
json_object_int_add(json, "ifindex", zvni->vxlan_if->ifindex);
json_object_string_add(json, "vtepIp",
inet_ntoa(zvni->local_vtep_ip));
json_object_string_add(json, "advertiseGatewayMacip",
zvni->advertise_gw_macip ? "Yes" : "No");
json_object_int_add(json, "numMacs", num_macs);
json_object_int_add(json, "numArpNd", num_neigh);
}
@ -641,6 +643,8 @@ static void zvni_print(zebra_vni_t *zvni, void **ctxt)
" Number of ARPs (IPv4 and IPv6, local and remote) "
"known for this VNI: %u\n",
num_neigh);
vty_out(vty, " Advertise-gw-macip: %s\n",
zvni->advertise_gw_macip ? "Yes" : "No");
}
}
@ -2751,8 +2755,12 @@ void zebra_vxlan_print_vnis(struct vty *vty, struct zebra_vrf *zvrf,
}
if (use_json) {
json = json_object_new_object();
json_object_string_add(json, "advertiseGatewayMacip",
zvrf->advertise_gw_macip ? "Yes" : "No");
json_object_int_add(json, "numVnis", num_vnis);
} else {
vty_out(vty, "Advertise gateway mac-ip: %s\n",
zvrf->advertise_gw_macip ? "Yes" : "No");
vty_out(vty, "Number of VNIs: %u\n", num_vnis);
vty_out(vty, "%-10s %-21s %-15s %-8s %-8s %-15s\n", "VNI",
"VxLAN IF", "VTEP IP", "# MACs", "# ARPs",