diff --git a/isisd/isis_sr.c b/isisd/isis_sr.c index f928185ffb..76cde6d28c 100644 --- a/isisd/isis_sr.c +++ b/isisd/isis_sr.c @@ -923,13 +923,14 @@ static int sr_adj_ip_disabled(struct isis_adjacency *adj, int family, } /** - * Activate local Prefix-SID when loopback interface goes up for IS-IS. + * Update the Node-SID flag of the configured Prefix-SID mappings in response + * to an address addition or removal event. * - * @param ifp Loopback Interface + * @param ifp Interface * * @return 0 */ -static int sr_if_new_hook(struct interface *ifp) +int sr_if_addr_update(struct interface *ifp) { struct sr_prefix_cfg *pcfgs[SR_ALGORITHM_COUNT] = {NULL}; struct isis_circuit *circuit; @@ -947,13 +948,7 @@ static int sr_if_new_hook(struct interface *ifp) if (!area) return 0; - /* - * Update the Node-SID flag of the configured Prefix-SID mappings if - * necessary. This needs to be done here since isisd reads the startup - * configuration before receiving interface information from zebra. - */ FOR_ALL_INTERFACES_ADDRESSES (ifp, connected, node) { - for (int i = 0; i < SR_ALGORITHM_COUNT; i++) { pcfgs[i] = isis_sr_cfg_prefix_find( area, connected->address, i); @@ -1313,7 +1308,6 @@ void isis_sr_init(void) hook_register(isis_adj_state_change_hook, sr_adj_state_change); hook_register(isis_adj_ip_enabled_hook, sr_adj_ip_enabled); hook_register(isis_adj_ip_disabled_hook, sr_adj_ip_disabled); - hook_register(isis_if_new_hook, sr_if_new_hook); } /** @@ -1325,5 +1319,4 @@ void isis_sr_term(void) hook_unregister(isis_adj_state_change_hook, sr_adj_state_change); hook_unregister(isis_adj_ip_enabled_hook, sr_adj_ip_enabled); hook_unregister(isis_adj_ip_disabled_hook, sr_adj_ip_disabled); - hook_unregister(isis_if_new_hook, sr_if_new_hook); } diff --git a/isisd/isis_sr.h b/isisd/isis_sr.h index f5f0adf241..4378760299 100644 --- a/isisd/isis_sr.h +++ b/isisd/isis_sr.h @@ -222,6 +222,7 @@ extern struct sr_adjacency *isis_sr_adj_sid_find(struct isis_adjacency *adj, int family, enum sr_adj_type type); extern void isis_area_delete_backup_adj_sids(struct isis_area *area, int level); +extern int sr_if_addr_update(struct interface *ifp); extern char *sr_op2str(char *buf, size_t size, mpls_label_t label_in, mpls_label_t label_out); extern int isis_sr_start(struct isis_area *area); diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c index 43e9865fce..4f3198a9fe 100644 --- a/isisd/isis_zebra.c +++ b/isisd/isis_zebra.c @@ -98,6 +98,8 @@ static int isis_zebra_if_address_add(ZAPI_CALLBACK_ARGS) isis_circuit_add_addr(circuit, c); } + sr_if_addr_update(c->ifp); + return 0; } @@ -125,6 +127,8 @@ static int isis_zebra_if_address_del(ZAPI_CALLBACK_ARGS) isis_circuit_del_addr(circuit, c); } + sr_if_addr_update(c->ifp); + connected_free(&c); return 0; diff --git a/tests/topotests/isis_tilfa_topo1/rt1/isisd.conf b/tests/topotests/isis_tilfa_topo1/rt1/isisd.conf index 620523512a..b425bb6b1f 100644 --- a/tests/topotests/isis_tilfa_topo1/rt1/isisd.conf +++ b/tests/topotests/isis_tilfa_topo1/rt1/isisd.conf @@ -17,7 +17,7 @@ interface eth-sw1 ip router isis 1 ipv6 router isis 1 isis hello-interval 1 - isis hello-multiplier 3 + isis hello-multiplier 10 isis priority 100 isis fast-reroute ti-lfa ! diff --git a/tests/topotests/isis_tilfa_topo1/rt1/step1/show_yang_interface_isis_adjacencies.ref b/tests/topotests/isis_tilfa_topo1/rt1/step1/show_yang_interface_isis_adjacencies.ref index d86f9ef658..9c5901b90f 100644 --- a/tests/topotests/isis_tilfa_topo1/rt1/step1/show_yang_interface_isis_adjacencies.ref +++ b/tests/topotests/isis_tilfa_topo1/rt1/step1/show_yang_interface_isis_adjacencies.ref @@ -11,14 +11,14 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0003", - "hold-timer": 3, + "hold-timer": 10, "neighbor-priority": 64, "state": "up" }, { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0002", - "hold-timer": 3, + "hold-timer": 10, "neighbor-priority": 64, "state": "up" } diff --git a/tests/topotests/isis_tilfa_topo1/rt2/isisd.conf b/tests/topotests/isis_tilfa_topo1/rt2/isisd.conf index 9c4b86208b..546e9222fe 100644 --- a/tests/topotests/isis_tilfa_topo1/rt2/isisd.conf +++ b/tests/topotests/isis_tilfa_topo1/rt2/isisd.conf @@ -16,7 +16,7 @@ interface eth-sw1 ip router isis 1 ipv6 router isis 1 isis hello-interval 1 - isis hello-multiplier 3 + isis hello-multiplier 10 isis fast-reroute ti-lfa ! interface eth-rt4-1 @@ -24,7 +24,7 @@ interface eth-rt4-1 ipv6 router isis 1 isis network point-to-point isis hello-interval 1 - isis hello-multiplier 3 + isis hello-multiplier 10 isis fast-reroute ti-lfa ! interface eth-rt4-2 @@ -32,7 +32,7 @@ interface eth-rt4-2 ipv6 router isis 1 isis network point-to-point isis hello-interval 1 - isis hello-multiplier 3 + isis hello-multiplier 10 isis fast-reroute ti-lfa ! router isis 1 diff --git a/tests/topotests/isis_tilfa_topo1/rt2/step1/show_yang_interface_isis_adjacencies.ref b/tests/topotests/isis_tilfa_topo1/rt2/step1/show_yang_interface_isis_adjacencies.ref index 69b6159d62..7d9463dd35 100644 --- a/tests/topotests/isis_tilfa_topo1/rt2/step1/show_yang_interface_isis_adjacencies.ref +++ b/tests/topotests/isis_tilfa_topo1/rt2/step1/show_yang_interface_isis_adjacencies.ref @@ -11,7 +11,7 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0004", - "hold-timer": 3, + "hold-timer": 10, "neighbor-priority": 0, "state": "up" } @@ -30,7 +30,7 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0004", - "hold-timer": 3, + "hold-timer": 10, "neighbor-priority": 0, "state": "up" } @@ -49,14 +49,14 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0001", - "hold-timer": 3, + "hold-timer": 10, "neighbor-priority": 100, "state": "up" }, { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0003", - "hold-timer": 3, + "hold-timer": 10, "neighbor-priority": 64, "state": "up" } diff --git a/tests/topotests/isis_tilfa_topo1/rt3/isisd.conf b/tests/topotests/isis_tilfa_topo1/rt3/isisd.conf index 1883575b7b..a41a4c14a9 100644 --- a/tests/topotests/isis_tilfa_topo1/rt3/isisd.conf +++ b/tests/topotests/isis_tilfa_topo1/rt3/isisd.conf @@ -16,7 +16,7 @@ interface eth-sw1 ip router isis 1 ipv6 router isis 1 isis hello-interval 1 - isis hello-multiplier 3 + isis hello-multiplier 10 isis fast-reroute ti-lfa ! interface eth-rt5-1 @@ -24,7 +24,7 @@ interface eth-rt5-1 ipv6 router isis 1 isis network point-to-point isis hello-interval 1 - isis hello-multiplier 3 + isis hello-multiplier 10 isis fast-reroute ti-lfa ! interface eth-rt5-2 @@ -32,7 +32,7 @@ interface eth-rt5-2 ipv6 router isis 1 isis network point-to-point isis hello-interval 1 - isis hello-multiplier 3 + isis hello-multiplier 10 isis fast-reroute ti-lfa ! router isis 1 diff --git a/tests/topotests/isis_tilfa_topo1/rt3/step1/show_yang_interface_isis_adjacencies.ref b/tests/topotests/isis_tilfa_topo1/rt3/step1/show_yang_interface_isis_adjacencies.ref index e75d5fe859..777c749819 100644 --- a/tests/topotests/isis_tilfa_topo1/rt3/step1/show_yang_interface_isis_adjacencies.ref +++ b/tests/topotests/isis_tilfa_topo1/rt3/step1/show_yang_interface_isis_adjacencies.ref @@ -11,7 +11,7 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0005", - "hold-timer": 3, + "hold-timer": 10, "neighbor-priority": 0, "state": "up" } @@ -30,7 +30,7 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0005", - "hold-timer": 3, + "hold-timer": 10, "neighbor-priority": 0, "state": "up" } @@ -49,14 +49,14 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0001", - "hold-timer": 3, + "hold-timer": 10, "neighbor-priority": 100, "state": "up" }, { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0002", - "hold-timer": 3, + "hold-timer": 10, "neighbor-priority": 64, "state": "up" } diff --git a/tests/topotests/isis_tilfa_topo1/rt4/isisd.conf b/tests/topotests/isis_tilfa_topo1/rt4/isisd.conf index 94f80d39d5..07ae7dbba1 100644 --- a/tests/topotests/isis_tilfa_topo1/rt4/isisd.conf +++ b/tests/topotests/isis_tilfa_topo1/rt4/isisd.conf @@ -17,7 +17,7 @@ interface eth-rt2-1 ipv6 router isis 1 isis network point-to-point isis hello-interval 1 - isis hello-multiplier 3 + isis hello-multiplier 10 isis fast-reroute ti-lfa ! interface eth-rt2-2 @@ -25,7 +25,7 @@ interface eth-rt2-2 ipv6 router isis 1 isis network point-to-point isis hello-interval 1 - isis hello-multiplier 3 + isis hello-multiplier 10 isis fast-reroute ti-lfa ! interface eth-rt5 @@ -33,7 +33,7 @@ interface eth-rt5 ipv6 router isis 1 isis network point-to-point isis hello-interval 1 - isis hello-multiplier 3 + isis hello-multiplier 10 isis fast-reroute ti-lfa ! interface eth-rt6 @@ -41,7 +41,7 @@ interface eth-rt6 ipv6 router isis 1 isis network point-to-point isis hello-interval 1 - isis hello-multiplier 3 + isis hello-multiplier 10 isis fast-reroute ti-lfa ! router isis 1 diff --git a/tests/topotests/isis_tilfa_topo1/rt4/step1/show_yang_interface_isis_adjacencies.ref b/tests/topotests/isis_tilfa_topo1/rt4/step1/show_yang_interface_isis_adjacencies.ref index 1d2c559588..0ca7a76bd4 100644 --- a/tests/topotests/isis_tilfa_topo1/rt4/step1/show_yang_interface_isis_adjacencies.ref +++ b/tests/topotests/isis_tilfa_topo1/rt4/step1/show_yang_interface_isis_adjacencies.ref @@ -11,7 +11,7 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0002", - "hold-timer": 3, + "hold-timer": 10, "neighbor-priority": 0, "state": "up" } @@ -30,7 +30,7 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0002", - "hold-timer": 3, + "hold-timer": 10, "neighbor-priority": 0, "state": "up" } @@ -49,7 +49,7 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0005", - "hold-timer": 3, + "hold-timer": 10, "neighbor-priority": 0, "state": "up" } @@ -68,7 +68,7 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0006", - "hold-timer": 3, + "hold-timer": 10, "neighbor-priority": 0, "state": "up" } diff --git a/tests/topotests/isis_tilfa_topo1/rt5/isisd.conf b/tests/topotests/isis_tilfa_topo1/rt5/isisd.conf index e83ae9677b..e637f8b3a6 100644 --- a/tests/topotests/isis_tilfa_topo1/rt5/isisd.conf +++ b/tests/topotests/isis_tilfa_topo1/rt5/isisd.conf @@ -17,7 +17,7 @@ interface eth-rt3-1 ipv6 router isis 1 isis network point-to-point isis hello-interval 1 - isis hello-multiplier 3 + isis hello-multiplier 10 isis fast-reroute ti-lfa ! interface eth-rt3-2 @@ -25,7 +25,7 @@ interface eth-rt3-2 ipv6 router isis 1 isis network point-to-point isis hello-interval 1 - isis hello-multiplier 3 + isis hello-multiplier 10 isis fast-reroute ti-lfa ! interface eth-rt4 @@ -33,7 +33,7 @@ interface eth-rt4 ipv6 router isis 1 isis network point-to-point isis hello-interval 1 - isis hello-multiplier 3 + isis hello-multiplier 10 isis fast-reroute ti-lfa ! interface eth-rt6 @@ -41,7 +41,7 @@ interface eth-rt6 ipv6 router isis 1 isis network point-to-point isis hello-interval 1 - isis hello-multiplier 3 + isis hello-multiplier 10 isis fast-reroute ti-lfa ! router isis 1 diff --git a/tests/topotests/isis_tilfa_topo1/rt5/step1/show_yang_interface_isis_adjacencies.ref b/tests/topotests/isis_tilfa_topo1/rt5/step1/show_yang_interface_isis_adjacencies.ref index f94b09e161..f40b0d353d 100644 --- a/tests/topotests/isis_tilfa_topo1/rt5/step1/show_yang_interface_isis_adjacencies.ref +++ b/tests/topotests/isis_tilfa_topo1/rt5/step1/show_yang_interface_isis_adjacencies.ref @@ -11,7 +11,7 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0003", - "hold-timer": 3, + "hold-timer": 10, "neighbor-priority": 0, "state": "up" } @@ -30,7 +30,7 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0003", - "hold-timer": 3, + "hold-timer": 10, "neighbor-priority": 0, "state": "up" } @@ -49,7 +49,7 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0004", - "hold-timer": 3, + "hold-timer": 10, "neighbor-priority": 0, "state": "up" } @@ -68,7 +68,7 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0006", - "hold-timer": 3, + "hold-timer": 10, "neighbor-priority": 0, "state": "up" } diff --git a/tests/topotests/isis_tilfa_topo1/rt6/isisd.conf b/tests/topotests/isis_tilfa_topo1/rt6/isisd.conf index 462492e909..1bf4acd3cd 100644 --- a/tests/topotests/isis_tilfa_topo1/rt6/isisd.conf +++ b/tests/topotests/isis_tilfa_topo1/rt6/isisd.conf @@ -17,7 +17,7 @@ interface eth-rt4 ipv6 router isis 1 isis network point-to-point isis hello-interval 1 - isis hello-multiplier 3 + isis hello-multiplier 10 isis fast-reroute ti-lfa ! interface eth-rt5 @@ -25,7 +25,7 @@ interface eth-rt5 ipv6 router isis 1 isis network point-to-point isis hello-interval 1 - isis hello-multiplier 3 + isis hello-multiplier 10 isis fast-reroute ti-lfa ! router isis 1 diff --git a/tests/topotests/isis_tilfa_topo1/rt6/step1/show_yang_interface_isis_adjacencies.ref b/tests/topotests/isis_tilfa_topo1/rt6/step1/show_yang_interface_isis_adjacencies.ref index 9d4d47b2af..8300ca0b5c 100644 --- a/tests/topotests/isis_tilfa_topo1/rt6/step1/show_yang_interface_isis_adjacencies.ref +++ b/tests/topotests/isis_tilfa_topo1/rt6/step1/show_yang_interface_isis_adjacencies.ref @@ -11,7 +11,7 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0004", - "hold-timer": 3, + "hold-timer": 10, "neighbor-priority": 0, "state": "up" } @@ -30,7 +30,7 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0005", - "hold-timer": 3, + "hold-timer": 10, "neighbor-priority": 0, "state": "up" } diff --git a/tests/topotests/isis_tilfa_topo1/test_isis_tilfa_topo1.py b/tests/topotests/isis_tilfa_topo1/test_isis_tilfa_topo1.py index f0724b9da6..e2bbf4588c 100755 --- a/tests/topotests/isis_tilfa_topo1/test_isis_tilfa_topo1.py +++ b/tests/topotests/isis_tilfa_topo1/test_isis_tilfa_topo1.py @@ -818,19 +818,19 @@ def test_rt6_step11(): rname, "show ip route isis json", outputs[rname][11]["show_ip_route.ref"], - count=10, + count=20, ) router_compare_json_output( rname, "show ipv6 route isis json", outputs[rname][11]["show_ipv6_route.ref"], - count=10, + count=20, ) router_compare_json_output( rname, "show mpls table json", outputs[rname][11]["show_mpls_table.ref"], - count=10, + count=20, ) @@ -946,6 +946,15 @@ def test_rib_ipv4_step13(): tgen.net["rt5"].cmd('vtysh -c "conf t" -c "int eth-rt6" -c "isis bfd"') tgen.net["rt6"].cmd('vtysh -c "conf t" -c "int eth-rt5" -c "isis bfd"') + expect = ( + '[{"multihop":false,"peer":"10.0.8.5","interface":"eth-rt5","status":"up"}]' + ) + router_compare_json_output( + rname, + "show bfd peers json", + expect, + ) + def test_rib_ipv6_step13(): logger.info("Test (step 13): verify IPv6 RIB") @@ -1015,7 +1024,7 @@ def test_rt6_step14(): rname, "show ip route isis json", outputs[rname][11]["show_ip_route.ref"], - count=10, + count=20, ) router_compare_json_output( rname, @@ -1028,7 +1037,7 @@ def test_rt6_step14(): rname, "show mpls table json", outputs[rname][11]["show_mpls_table.ref"], - count=10, + count=20, )