From da086a3ba69a87904f2cb10c75a16ee82b671bf4 Mon Sep 17 00:00:00 2001 From: Chirag Shah Date: Wed, 17 Jan 2018 10:55:46 -0800 Subject: ospf6d: spf calculation w/ multiple router lsas An OSPFv3 enabled Router can originate or receive multiple Link State-IDs for Router LSAs. As per RFC 5340 A 4.3, more than one Router LSAs, from given Vertex is considered (as concatenated) single large Router LSA. Created hidden show command to simulate concatenated large LSA from advertising/self Router LSAs. Ticket:CM-19329 Reviewed By: Testing Done: Simulate 160 subinterfaces between R1 === R2--R3, This triggers R1 and R2 to generate multiple link state IDs for Router LSAs. During SPF calculation only aggregated single router LSA processed and SPF tree formed. Signed-off-by: Chirag Shah --- ospf6d/ospf6d.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'ospf6d/ospf6d.c') diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index d28d9dd064..bbc1cc18f6 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -360,6 +360,49 @@ DEFUN (show_ipv6_ospf6_database_router, return CMD_SUCCESS; } +DEFUN_HIDDEN (show_ipv6_ospf6_database_aggr_router, + show_ipv6_ospf6_database_aggr_router_cmd, + "show ipv6 ospf6 database aggr adv-router A.B.C.D", + SHOW_STR + IPV6_STR + OSPF6_STR + "Display Link state database\n" + "Aggregated Router LSA\n" + "Search by Advertising Router\n" + "Specify Advertising Router as IPv4 address notation\n") +{ + int level = OSPF6_LSDB_SHOW_LEVEL_DETAIL; + uint16_t type = htons(OSPF6_LSTYPE_ROUTER); + int idx_ipv4 = 6; + struct listnode *i; + struct ospf6 *o = ospf6; + struct ospf6_area *oa; + struct ospf6_lsdb *lsdb; + uint32_t adv_router = 0; + + inet_pton(AF_INET, argv[idx_ipv4]->arg, &adv_router); + + for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + if (adv_router == o->router_id) + lsdb = oa->lsdb_self; + else + lsdb = oa->lsdb; + if (ospf6_create_single_router_lsa(oa, lsdb, + adv_router) == NULL) { + vty_out(vty, "Adv router is not found in LSDB."); + return CMD_SUCCESS; + } + ospf6_lsdb_show(vty, level, &type, NULL, NULL, + oa->temp_router_lsa_lsdb); + /* Remove the temp cache */ + ospf6_remove_temp_router_lsa(oa); + } + + vty_out(vty, "\n"); + + return CMD_SUCCESS; +} + DEFUN (show_ipv6_ospf6_database_type_id, show_ipv6_ospf6_database_type_id_cmd, "show ipv6 ospf6 database linkstate-id A.B.C.D []", @@ -1219,6 +1262,7 @@ void ospf6_init(void) install_element( VIEW_NODE, &show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd); + install_element(VIEW_NODE, &show_ipv6_ospf6_database_aggr_router_cmd); /* Make ospf protocol socket. */ ospf6_serv_sock(); -- cgit v1.2.3