proc ClearPortOwnership {{portList None}} { # This Proc could get all the ports dynamically or you could pass in # a list of ports. # # WARNING: If you don't pass in a list of $portList, then this function # will clear port ownership on ALL the ports connected to your chassis. # # portList: The format is: [list "$ixChassisIp $cardNum $portNum" ...] if {$portList == "None"} { set configuredPorts [GetPortsAssignedToVports] set portList [lindex $configuredPorts 0] } puts \n foreach port $portList { set ixChassisIp [lindex $port 0] set cardId [lindex $port 1] set portId [lindex $port 2] set isPortOwned [ixNet getAttribute [ixNet getRoot]/availableHardware/chassis:"$ixChassisIp"/card:$cardId/port:$portId -owner] if {$isPortOwned != ""} { puts "ClearPortOwnership: $ixChassisIp/$cardId/$portId" set chassisObj [lindex [ixNet getList [ixNet getRoot]/availableHardware chassis] end] if {[catch {ixNet exec clearOwnership [ixNet getRoot]/availableHardware/chassis:"$ixChassisIp"/card:$cardId/port:$portId} errMsg]} { puts "\nError: ClearPortOwnership: $errMsg" return 1 } } else { puts "ClearPortOwnership: $ixChassisIp/$cardId/$portId is not currently owned" } } return 0 }