Anil, I think the pseudocode will work correctly as currently written. It is safe to store the next-hops for spf_root to reach min_node immediately after removing min_node, the heap element with the lowest value of spf_metric, from spf_heap. The reasoning is described below.
spf_heap starts out with just spf_root in it, and spf_root gets removed the first time that the line min_node = remove_lowest(spf_heap) is hit. So now spf_heap is empty and the only way that a node gets put into spf_heap is with the line: insert_or_update(spf_heap, intf.remote_node). Immediately before this line, intf.remote_node.next_hops are either created based on intf, or inherited from min_node. Either way, a given node G can't get into spf_heap without having its next_hops value set to some value. The G.next_hops are the interfaces on spf_root to reach G on the shortest path yet explored. As the SPF algorithm runs, the value of G.next_hops can be changed, either as a new shortest path is explored, or as an equal cost path is explored. When it comes time to remove G from spf_heap (via min_node = remove_lowest(spf_heap) ), G has the lowest spf_metric of any node remaining on the heap. There is no chance that any paths explored in the SPF algorithm after G is removed from the heap will result in changing G.next_hops because any such path would necessarily have an spf_metric higher than G.spf_metric. Therefore, it is safe to call Store_Results(G, direction) after G is removed from spf_heap, because G.next_hops won't get changed anymore. The last node on spf_heap (the one with the highest value of spf_metric in the topology) will get removed and Store_Results will get called, so last node will be completely processed. The algorithm will go through the motions of exploring all of the interfaces of last node, but it won't result in any new remote nodes being added to spf_heap. So "while (spf_heap is not empty)" will terminate the next time around. I hope this makes sense. Chris From: Anil Kumar S N (VRP Network BL) [mailto:[email protected]] Sent: Thursday, June 25, 2015 7:54 AM To: Anil Kumar S N (VRP Network BL); Chris Bowers; Gábor Sándor Enyedi; [email protected]; Alia Atlas; [email protected] Cc: [email protected]; [email protected] Subject: RE: [rtgwg] draft-ietf-rtgwg-mrt-frr-algorithm-03 Chris, Store_Results should be called after nexthop is updated, The last node processed and its nexthop is not updated I feel. I might be wrong, Please correct me if I am wrong. Base : SPF_No_Traverse_Block_Root(spf_root, block_root, direction) Initialize spf_heap to empty Initialize nodes' spf_metric to infinity and next_hops to empty spf_root.spf_metric = 0 insert(spf_heap, spf_root) while (spf_heap is not empty) min_node = remove_lowest(spf_heap) Store_Results(min_node, direction) if ((min_node is spf_root) or (min_node is not block_root)) foreach interface intf of min_node if ( ( ((direction is FORWARD) and intf.OUTGOING) or ((direction is REVERSE) and intf.INCOMING) ) and In_Common_Block(spf_root, intf.remote_node) ) path_metric = min_node.spf_metric + intf.metric if path_metric < intf.remote_node.spf_metric intf.remote_node.spf_metric = path_metric if min_node is spf_root intf.remote_node.next_hops = make_list(intf) else intf.remote_node.next_hops = min_node.next_hops insert_or_update(spf_heap, intf.remote_node) else if path_metric is intf.remote_node.spf_metric if min_node is spf_root add_to_list(intf.remote_node.next_hops, intf) else add_list_to_list(intf.remote_node.next_hops, min_node.next_hops) Modified : SPF_No_Traverse_Block_Root(spf_root, block_root, direction) Initialize spf_heap to empty Initialize nodes' spf_metric to infinity and next_hops to empty spf_root.spf_metric = 0 insert(spf_heap, spf_root) while (spf_heap is not empty) min_node = remove_lowest(spf_heap) Store_Results(min_node, direction) if ((min_node is spf_root) or (min_node is not block_root)) foreach interface intf of min_node if ( ( ((direction is FORWARD) and intf.OUTGOING) or ((direction is REVERSE) and intf.INCOMING) ) and In_Common_Block(spf_root, intf.remote_node) ) path_metric = min_node.spf_metric + intf.metric if path_metric < intf.remote_node.spf_metric intf.remote_node.spf_metric = path_metric if min_node is spf_root intf.remote_node.next_hops = make_list(intf) else intf.remote_node.next_hops = min_node.next_hops insert_or_update(spf_heap, intf.remote_node) else if path_metric is intf.remote_node.spf_metric if min_node is spf_root add_to_list(intf.remote_node.next_hops, intf) else add_list_to_list(intf.remote_node.next_hops, min_node.next_hops) Store_Results(min_node, direction) Thanks & Regards Anil S N "Be liberal in what you accept, and conservative in what you send" - Jon Postel From: Anil Kumar S N (VRP Network BL) Sent: 23 June 2015 21:29 To: 'Chris Bowers'; Gábor Sándor Enyedi; [email protected]<mailto:[email protected]>; Alia Atlas; [email protected]<mailto:[email protected]> Cc: [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]> Subject: RE: [rtgwg] draft-ietf-rtgwg-mrt-frr-algorithm-03 Chris, Yes it definitely makes sense, thanks I should have thought about this. Thanks & Regards Anil S N "Be liberal in what you accept, and conservative in what you send" - Jon Postel From: Chris Bowers [mailto:[email protected]] Sent: 23 June 2015 20:19 To: Anil Kumar S N (VRP Network BL); Gábor Sándor Enyedi; [email protected]<mailto:[email protected]>; Alia Atlas; [email protected]<mailto:[email protected]> Cc: [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]> Subject: RE: [rtgwg] draft-ietf-rtgwg-mrt-frr-algorithm-03 Anil, Reusing the topology below, R (the gadag_root) will have block_id=0 while A,B,C,D and E will have block_id=1. so the first OR'd condition in In_Common_Block(R,y) will always be false when determining if R is in the same block as A,B,C,D, or E. The third OR'd condition will also be false because R.localroot = None. However, the second OR'd condition will be true because R = B.localroot (for example), returning true for In_Common_Block(R,B). Does this make sense? Chris [E]----| (5,0) | | | | | [R] [D]---[C] (0,0) (4,0) (3,0) | | | | [A]---------[B] (1,0) (2,0) From: Anil Kumar S N (VRP Network BL) [mailto:[email protected]] Sent: Tuesday, June 23, 2015 6:04 AM To: Chris Bowers; Gábor Sándor Enyedi; [email protected]<mailto:[email protected]>; Alia Atlas; [email protected]<mailto:[email protected]> Cc: [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]> Subject: RE: [rtgwg] draft-ietf-rtgwg-mrt-frr-algorithm-03 Hi Chirs, gadag_root.localroot will remain as None at the end of algorithm and gadag_root.block_id will be 0 (rest of the nodes in the block will be 1 higher than gadag_root.block_id) Below psudocode will return false while comparing a node in a block and gadag_root. Please correct me if I am wrong. In_Common_Block(x, y) if ( (x.block_id is y.block_id) or (x is y.localroot) or (y is x.localroot) ) return true return false Thanks & Regards Anil S N "Be liberal in what you accept, and conservative in what you send" - Jon Postel
_______________________________________________ rtgwg mailing list [email protected] https://www.ietf.org/mailman/listinfo/rtgwg
