proc CreateIpv4Ngpf {args} { set direction increment set step 0.0.0.0 set paramList {} set argIndex 0 while {$argIndex < [llength $args]} { set currentArg [lindex $args $argIndex] switch -exact -- $currentArg { -ethernetObj { set ethernetObj [lindex $args [expr $argIndex + 1]] incr argIndex 2 } -name { set name [lindex $args [expr $argIndex + 1]] #append paramList " -name $name" incr argIndex 2 } -ipAddress { set ipAddress [lindex $args [expr $argIndex + 1]] append paramList " -start $ipAddress" incr argIndex 2 } -direction { set direction [lindex $args [expr $argIndex + 1]] append paramList " -direction $direction" incr argIndex 2 } -step { set step [lindex $args [expr $argIndex + 1]] append paramList " -step $step" incr argIndex 2 } -ipv4PortStep { set ipv4PortStep [lindex $args [expr $argIndex + 1]] incr argIndex 2 } default { puts "Connect: No such parameter: $currentArg" return 1 } } } puts "\nCreateIpv4Ngpf: Adding new IPv4 stack to ethObj: $ethernetObj" set ipv4Obj [ixNet add $ethernetObj ipv4] if {[info exists name]} { ixNet setAttribute $ipv4Obj -name $name } ixNet commit set ipv4Multivalue [ixNet getAttribute $ipv4Obj -address] puts "\t$paramList" if {[catch {eval ixNet setMultiAttribute $ipv4Multivalue/counter $paramList} errMsg]} { puts "\nCreateIpv4Ngpf failed: $errMsg" return 1 } ixNet commit if {[info exists ipv4PortStep]} { puts "\nConfiguring ipv4PortStep: $ipv4Multivalue/nest:1 $ipv4PortStep" ixNet setAttribute $ipv4Multivalue/nest:1 -step $ipv4PortStep ixNet commit } return [lindex [ixNet remapIds $ipv4Obj] 0] }