I have used nci.tlib but I haven’t used it to go through the route section of the NetConfig file. Here is an example that looks at ip address and port, which are in the PROTOCOL section. The example limits it to outbound (ob) connections because that is what I was looking at when I wrote it.
As you can probably tell, netcfgGetConnList returns a Tcl list. But exactly what the elements of that list are, I don’t know. I just know you can pass them to netcfgGetConnData to get “sections” of that connection/thread. netcfgGetConnData returns a Tcl keyed list.
I haven’t used nci.tlib enough to get a feel for when I am getting what back from a call. There is probably a pattern or something logical about it. But I don’t know what it is so I can’t tell you. If you figure it out, let me know.
This example is probably something (or based on something) I copied from someone else on Clovertech. If so, thanks.
netcfgLoad “$::env(HCISITEDIR)/NetConfig”
set conns [netcfgGetConnList]
set conns [lsort $conns]
set protocol “”
echo [format “%-24s %-20s %-10s” Conn :Host :Local_IP]
foreach conn $conns {
if {[regexp {.*ob.*} $conn]} {
catch {set protocol [netcfgGetConnData $conn “PROTOCOL”]
set host [keylget protocol “HOST”]
set local_ip [keylget protocol “LOCAL_IP”]
set port [keylget protocol PORT]
echo “[format %-25s $conn]:[format %-20s $host/$port]:$local_ip”
}
}
}