ixCheckOwnership
ixCheckOwnership - checks the ownership for a list of ports
SYNOPSIS
ixCheckOwnership portList
DESCRIPTION
The ixCheckOwnership command checks the ownership on a list of ports; the port list must be passed by value. It accepts * as a wild card to indicate all cards or all ports on a card. A wild card cannot be used for chassis ID. Also, if a combination of a list element containing wild cards and port numbers are passed, then the port list passed MUST be in a sorted order, otherwise the some of those ports might not make it in the list.
ARGUMENTS
portList
(By value) The list of ports in one of the following formats:
One of the following literal strings, or a reference to a variable with the $ (for example, $pl after set pl ...)
{{1 1 1}}
{{1 1 1} {1 1 2} {1 1 3} {1 1 4}}
{{1 1 *} {1 2 1} {1 2 2}}
{1,1,* 1,2,1 1,2,2}
RETURNS
0
All of the ports are available for the `taking'.
100
One or more of the ports are owned by someone else.
EXAMPLES
package req IxTclHal
set host galaxy
set username George
# Check if we're running on UNIX - connect to the TCL Server
# which must be running on the chassis
if [isUNIX] {
if [ixConnectToTclServer $host] {
ixPuts "Could not connect to $host"
return 1
}
}
# Now connect to the chassis
if [ixConnectToChassis $host] {
ixPuts $::ixErrorInfo
return 1
}
# Get the chassis ID to use in port lists
set chas [ixGetChassisID $host]
set portListG [list [list $chas 2 2]]
# Login before taking ownership
if [ixLogin $username] {
ixPuts $::ixErrorInfo
return 1
}
# Take ownership of the ports we'll use
if [ixTakeOwnership $portListG force] {
ixPuts $::ixErrorInfo
return 1
}
# Login Bill and make a port list for all ports on cards 1 and 2
ixLogin bill
set portListB [list [list $chas 1 *] [list $chas 2 *]]
# This should fail because 1, 2, 2 is owned by George
if {[ixCheckOwnership $portListB] == 0} {
ixPuts "Ports $portListB are available"
} else {
ixPuts "One or more of $portListB are unavailable"
}
# Now we'll avoid that port and express the list a different way
set portListB [list 1,1,* 1,2,1]
if {[ixCheckOwnership $portListB] == 0} {
ixPuts "Ports $portListB are available"
} else {
ixPuts "One or more of $portListB are unavailable"
}
# Disconnect from the chassis we're using
ixDisconnectFromChassis $host
# If we're running on UNIX, disconnect from the TCL Server
if [isUNIX] {
ixDisconnectTclServer $host
}
SEE ALSO
ixClearOwnership, ixLogin, ixLogout, ixPortClearOwnership,ixPortTakeOwnership, ixTakeOwnership