proc SetCounterMultiValueNgpf { multiValue propertyIndex action } { # This API is for setting NGPF multivalue "property index" to true or false. # It checks to see if there is an overlay for the $propertyIndex. # If none, then create an overlay for the $propertyIndex. # If exists, verify if the overlay is for the $propertyIndex. # If it's not for the $propertyIndex, then create an overlay for it. # Example usage: EnableDisableSuppressArp calls this to # create, enable or disable a property index # in which a property can have multiple indexes. set multiValueCurrentPattern [ixNet getAttribute $multiValue -pattern] if {$multiValueCurrentPattern != "counter"} { ixNet setAttribute $multiValue -pattern counter ixNet commit ixNet setAttribute $multiValue/counter -start $action ixNet commit } set overlayList [ixNet getList $multiValue overlay] set overlayDiscoveredFlag 0 if {$overlayList != ""} { foreach overlay $overlayList { set currentIndex [ixNet getAttribute $overlay -index] if {$currentIndex == $propertyIndex} { set overlayDiscoveredFlag 1 puts "\nSetNgpfCounterMultiValue: Action = $action : propertyIndex = $propertyIndex" puts "\t$overlay" catch {ixNet setMultiAttr $overlay -value $action -valueStep $action -count 1 -index $propertyIndex} errMsg if {$errMsg != "::ixNet::OK"} { puts "\nError SetNgpfCounterMultiValue: Set action to $action for overlay $currentOverlay: $errMsg" return 1 } ixNet commit } } if {$overlayDiscoveredFlag == 0} { # Getting here means no overlay found for the property Index. # Have to create an overlay with the proper -index number. puts "\nSetNgpfCounterMultiValue: No NGPF overlay for propertyIndex: $propertyIndex" puts "Creating new overlay" set currentOverlay [ixNet add $multiValue overlay] puts "\nSetNgpfCounterMultiValue: Action = $action : propertyIndex = $propertyIndex" puts "\t$overlay" catch {ixNet setMultiAttr $currentOverlay -value $action -valueStep $action -count 1 -index $propertyIndex} errMsg if {$errMsg != "::ixNet::OK"} { puts "\nError SetNgpfCounterMultiValue: Set action to $action for overlay $currentOverlay: $errMsg\n" return 1 } ixNet commit } } if {$overlayList == ""} { # Getting here means there are no overlays # Create Overlays with proper index number based on the portIndex # in $root/globals/topology/ipv4 -rowNames indexes puts "\nSetNgpfCounterMultiValue: No overlay exists" set currentOverlay [ixNet add $multiValue overlay] puts "Creating overlay: $currentOverlay" catch {ixNet setMultiAttr $currentOverlay -value $action -valueStep $action -count 1 -index $propertyIndex} errMsg if {$errMsg != "::ixNet::OK"} { puts "\nError SetNgpfCounterMultiValue: Set action to $action for overlay $currentOverlay: $errMsg\n" return 1 } ixNet commit } return 0 }