proc GetPorts {{ixChassisIp None}} { # Get all the ports from $ixChassisIp set chassisObjList [ixNet getList [ixNet getRoot]/availableHardware chassis] if {$chassisObjList == ""} { puts "\nError: GetPorts: No chassis is connected" return 1 } foreach chassisObj $chassisObjList { set chassisIp [ixNet getAttribute $chassisObj -hostname] if {$ixChassisIp == "None"} { set ixChassisIp $chassisIp break } if {$ixChassisIp != "None"} { if {$ixChassisIp == $chassisIp} { set ixChassisIp $chassisIp break } else { continue } } } set portList {} set cardList [ixNet getList $chassisObj card] foreach cardObj $cardList { set portObjList [ixNet getList $cardObj port] foreach port $portObjList { # ::ixNet::OBJ-/availableHardware/chassis:"192.168.70.11"/card:2/port:1 set cardId [lindex [split [lindex [split $port /] 3] :] end] set portId [lindex [split [lindex [split $port /] end] :] end] lappend portList [list $ixChassisIp $cardId $portId] } } return $portList }