proc VerifyAllProtocolSessionsNgpf {} { # This API will loop through each created Topology Group and verify # all the created protocols for session up for up to 90 seconds total. # # Returns 0 if all sessions are UP. # Returns 1 if any session remains DOWN after 90 seconds. # TODO: Create an IPv6 protocol list to also support IPv6 set protocolList [list ancp \ bfdv4Interface \ bgpIpv4Peer \ dhcpv4relayAgent \ dhcpv4server \ geneve \ greoipv4 \ igmpHost \ igmpQuerier \ lac \ ldpBasicRouter \ ldpConnectedInterface \ ldpTargetedRouter \ lns \ openFlowController \ openFlowSwitch \ ospfv2 \ ovsdbcontroller \ ovsdbserver \ pcc \ pce \ pimV4Interface \ ptp \ rsvpteIf \ rsvpteLsps \ tag \ vxlan \ ] set sessionDownList [list down notStarted] set startCounter 1 set timeEnd 120 foreach protocol $protocolList { foreach topology [ixNet getList [ixNet getRoot] topology] { foreach deviceGroup [ixNet getList $topology deviceGroup] { foreach ethernet [ixNet getList $deviceGroup ethernet] { foreach ipv4 [ixNet getList $ethernet ipv4] { foreach currentProtocol [ixNet getList $ipv4 $protocol] { for {set timer $startCounter} {$timer <= $timeEnd} {incr timer} { # up up set currentStatus [ixNet getAttribute $currentProtocol -sessionStatus] puts "\n$currentProtocol" puts "\tTotal sessions: [llength $currentStatus)]" puts "\tCurrent session status: $currentStatus" set totalDownSessions 0 foreach eachStatus $currentStatus { if {$eachStatus != "up"} { incr totalDownSessions } } puts "\tTotal sessions Down: $totalDownSessions" if {$timer < $timeEnd} { if {[lsearch $currentStatus notStarted] != -1} { puts "\tSession not started. Wait $timer/$timeEnd seconds" after 1000 continue } if {[lsearch $currentStatus down] == -1} { puts "\tAll sessions are all up" set startCounter $timer set breakFlag 1 break } if {$timer < $timeEnd} { foreach element $sessionDownList { if {[lsearch $currentStatus $element] != -1} { puts "\tSessions are started, but still down. Wait $timer/$timeEnd seconds" after 1000 } } } } if {$timer == $timeEnd} { foreach element $sessionDownList { if {[lsearch $currentStatus $element] != -1} { puts "\tProtocol session failed to come up after $timeEnd seconds" return 1 } } } } } } } } } } return 0 }