proc DisableTrafficItemByName { Name } { foreach trafficItem [ixNet getList [ixNet getRoot]traffic trafficItem] { set trafficItemName [ixNet getAttribute $trafficItem -name] if {[regexp $Name $trafficItemName]} { catch {ixNet setAttribute $trafficItem -enabled False} errMsg if {$errMsg != "::ixNet::OK"} { puts "\nError DisableTrafficItemByName: $Name : $errMsg\n" return 1 } ixNet commit puts "\nDisableTrafficItemByName: $Name" return 0 } } puts "\nError DisableTrafficItemByName: No such traffic item name: $Name\n" return 1 } Optionally, you could pass it in. # closeServerOnDisconnect: 0|1 # # Examples: # To connect to an existing Linux API server session: # Connect -apiServerIp 192.168.70.12 -port 443 -ixNetworkVersion 8.50 -sessionId 1 -apiKey $apiKey -closeServerOnDisconnect 0 # Set the Linux API server admin login default credentials set username None set password None set apiKey None set sessionId None set osPlatform windows set argIndex 0 while {$argIndex < [llength $args]} { set currentArg [lindex $args $argIndex] switch -exact -- $currentArg { -osPlatform { set osPlatform [lindex $args [expr $argIndex + 1]] incr argIndex 2 } -apiServerIp { set apiServerIp [lindex $args [expr $argIndex + 1]] incr argIndex 2 append paramList " $apiServerIp" } -port { set port [lindex $args [expr $argIndex + 1]] incr argIndex 2 append paramList " -port $port" } -ixNetworkVersion { set ixNetworkVersion [lindex $args [expr $argIndex + 1]] incr argIndex 2 append paramList " -version $ixNetworkVersion" } -apiKey { set apiKey [lindex $args [expr $argIndex + 1]] incr argIndex 2 append paramList " -apiKey $apiKey" } -sessionId { set sessionId [lindex $args [expr $argIndex + 1]] incr argIndex 2 append paramList " -sessionId $sessionId" } -username { set username [lindex $args [expr $argIndex + 1]] incr argIndex 2 append paramList " -username $username" } -password { set password [lindex $args [expr $argIndex + 1]] incr argIndex 2 append paramList " -username $password" } -closeServerOnDisconnect { set closeServerOnDisconnect [lindex $args [expr $argIndex + 1]] append paramList " -closeServerOnDisconnect $closeServerOnDisconnect" incr argIndex 2 } default { puts "Connect: No such parameter: $currentArg" return 1 } } } # For Linux API server login to get the API key if {$osPlatform == "linux"} { if {$apiKey == "None"} { set apiKey [GetApiKey $apiServerIp $username $password] if {$apiKey == 1} { return 1 } append paramList " -apiKey $apiKey" } } append paramList " -setAttribute strict" puts "\nConnecting to API server: $apiServerIp" if {[catch {set connectStatus [eval ixNet connect $paramList]} errMsg]} { puts "\nConnect failed: $errMsg" return 1 } puts "\nConnectStatus: $connectStatus" return 0 }