# Verify that links to external interfaces are properly configured
if { $mode == "exec" } {
- set extifcs [nexec ifconfig -l]
+ # space-separated popis interfacea (BSD ifconfig -l)
+ set extifcs [nexec ./ifconfig-l]
+ # izbaci loopback interface iz popisa (BSD lo)
set extifcs \
- [lreplace $extifcs [lsearch $extifcs lo0] [lsearch $extifcs lo0]]
+ [lreplace $extifcs [lsearch $extifcs lo] [lsearch $extifcs lo]]
foreach node $node_list {
if { [nodeType $node] == "rj45" } {
set i [lsearch $extifcs [getNodeName $node]]
# * name -- the name of the new interface
#****
proc createIfc { eid type hook } {
- catch { exec printf "mkpeer $type $hook $hook \n show .$hook" | vimage $eid ngctl -f - } nglist
- return [lindex $nglist 1]
+ puts { catch { exec printf "mkpeer $type $hook $hook \n show .$hook" | vimage $eid ngctl -f - } nglist }
+### return [lindex $nglist 1]
+ return false
}
global mac_byte4 mac_byte5
set node_id "$eid\.$node"
- nexec vimage -c $node_id
- nexec vimage $node_id hostname [getNodeName $node]
- nexec vimage $node_id sysctl vfs.morphing_symlinks=1
+ nexec echo vimage -c $node_id
+ nexec echo vimage $node_id hostname [getNodeName $node]
+ nexec echo vimage $node_id sysctl vfs.morphing_symlinks=1
foreach ifc [ifcList $node] {
switch -exact [string range $ifc 0 2] {
eth {
set ifid [createIfc $eid eiface ether]
- nexec vimage $eid vimage -i $node $ifid $ifc
+ nexec echo vimage $eid vimage -i $node $ifid $ifc
set peer [peerByIfc $node $ifc]
if { [nodeType $peer] == "rj45" } {
incr mac_byte4
}
}
- nexec vimage $node_id ifconfig $ifc link $ether
+ nexec echo vimage $node_id ifconfig $ifc link $ether
set ngnodemap($ifc@$node_id) $ifid
}
ser {
set ifnum [string range $ifc 3 end]
set ifid [createIfc $eid iface inet]
- nexec vimage $eid ngctl mkpeer $ifid: cisco inet inet
- nexec vimage $eid ngctl connect $ifid: $ifid:inet inet6 inet6
- nexec vimage $eid ngctl msg $ifid: broadcast
- nexec vimage $eid ngctl name $ifid:inet hdlc$ifnum\@$node
- nexec vimage $eid vimage -i $node $ifid $ifc
+ nexec echo vimage $eid ngctl mkpeer $ifid: cisco inet inet
+ nexec echo vimage $eid ngctl connect $ifid: $ifid:inet inet6 inet6
+ nexec echo vimage $eid ngctl msg $ifid: broadcast
+ nexec echo vimage $eid ngctl name $ifid:inet hdlc$ifnum\@$node
+ nexec echo vimage $eid vimage -i $node $ifid $ifc
set ngnodemap(hdlc$ifnum@$node_id) hdlc$ifnum\@$node
}
}
set cpumax [lindex [lsearch -inline $cpuconf {max *}] 1]
set cpuweight [lindex [lsearch -inline $cpuconf {weight *}] 1]
if { $cpumin != "" } {
- nexec vimage -m $node_id cpumin $cpumin
+ nexec echo vimage -m $node_id cpumin $cpumin
}
if { $cpumax != "" } {
- nexec vimage -m $node_id cpumax $cpumax
+ nexec echo vimage -m $node_id cpumax $cpumax
}
if { $cpuweight != "" } {
- nexec vimage -m $node_id cpuweight $cpuweight
+ nexec echo vimage -m $node_id cpuweight $cpuweight
}
- nexec vimage $node_id sysctl net.inet.icmp.bmcastecho=1
- nexec vimage $node_id sysctl net.inet.icmp.icmplim=0
- nexec vimage $node_id ifconfig lo0 inet localhost
- nexec vimage $node_id route add 224.0.0.0/4 localhost
+ nexec echo vimage $node_id sysctl net.inet.icmp.bmcastecho=1
+ nexec echo vimage $node_id sysctl net.inet.icmp.icmplim=0
+ nexec echo vimage $node_id ifconfig lo0 inet localhost
+ nexec echo vimage $node_id route add 224.0.0.0/4 localhost
}
nexec chmod 1777 $node_dir
foreach ifc [ifcList $node] {
set mtu [getIfcMTU $node $ifc]
- nexec vimage $node_id ifconfig $ifc mtu $mtu
+ nexec echo vimage $node_id ifconfig $ifc mtu $mtu
}
set check [info exists viewcustomid]
close $setkeyFileId
set errorstr ""
- set error [catch "nexec vimage $node_id setkey -f \
+ set error [catch "nexec echo vimage $node_id setkey -f \
$node_dir/setkey.conf" errorstr]
if { $error == "1" } {
setkeyError $node_id $errorstr
nexec close_conf_file
}
- catch "nexec vimage $node_id $bootcmd $node_dir/boot.conf >& $node_dir/out.log &"
+ catch "nexec echo vimage $node_id $bootcmd $node_dir/boot.conf >& $node_dir/out.log &"
}
#****f* exec.tcl/l3node.shutdown
#****
proc l3node.shutdown { eid node } {
set node_id "$eid\.$node"
- catch "nexec vimage $node_id kill -9 -1 2> /dev/null"
+ catch "nexec echo vimage $node_id kill -9 -1 2> /dev/null"
foreach ifc [ifcList $node] {
foreach ipv4 [getIfcIPv4addr $node $ifc] {
- catch "nexec vimage $node_id ifconfig $ifc $ipv4 -alias"
+ catch "nexec echo vimage $node_id ifconfig $ifc $ipv4 -alias"
}
foreach ipv6 [getIfcIPv6addr $node $ifc] {
- catch "nexec vimage $node_id ifconfig $ifc inet6 $ipv6 -alias"
+ catch "nexec echo vimage $node_id ifconfig $ifc inet6 $ipv6 -alias"
}
}
}
proc l3node.destroy { eid node } {
set node_id $node
foreach ifc [ifcList $node] {
- catch { nexec vimage $eid ngctl msg $ifc@$node_id: shutdown }
+ catch { nexec echo vimage $eid ngctl msg $ifc@$node_id: shutdown }
set ifnum [string range $ifc 3 end]
set ifname [string range $ifc 0 2]
if { $ifname == "ser" } {
- catch { nexec vimage $eid ngctl msg hdlc$ifnum@$node_id: shutdown }
+ catch { nexec echo vimage $eid ngctl msg hdlc$ifnum@$node_id: shutdown }
}
}
- catch {nexec vimage -d $node_id}
+ catch {nexec echo vimage -d $node_id}
set node_dir "/tmp/$eid/$node"
nexec rm -fr $node_dir
}
set t_start [clock seconds]
- catch { nexec vimage -c $eid }
+ catch { nexec echo vimage -c $eid }
catch { nexec rm -fr /tmp/$eid }
catch { nexec mkdir /tmp/$eid }
[lindex [[typemodel $lnode1].nghook $eid $lnode1 $ifname1] 1]
set nghook2 \
[lindex [[typemodel $lnode2].nghook $eid $lnode2 $ifname2] 1]
- nexec vimage $eid ngctl mkpeer $ngpeer1: pipe $nghook1 upper
- nexec vimage $eid ngctl name $ngpeer1:$nghook1 $lname
- nexec vimage $eid ngctl connect $lname: $ngpeer2: lower $nghook2
+ nexec echo vimage $eid ngctl mkpeer $ngpeer1: pipe $nghook1 upper
+ nexec echo vimage $eid ngctl name $ngpeer1:$nghook1 $lname
+ nexec echo vimage $eid ngctl connect $lname: $ngpeer2: lower $nghook2
# Ethernet frame has a 14-byte header - this is a temp. hack!!!
- nexec vimage $eid ngctl msg $lname: setcfg "{ header_offset=14 }"
+ nexec echo vimage $eid ngctl msg $lname: setcfg "{ header_offset=14 }"
# Link parameters
- nexec vimage $eid ngctl msg $lname: setcfg \
+ nexec echo vimage $eid ngctl msg $lname: setcfg \
"{ bandwidth=$bandwidth delay=$delay \
upstream={ BER=$ber duplicate=$dup } \
downstream={ BER=$ber duplicate=$dup } }"
global execMode
set t_start [clock seconds]
- if { [catch {nexec vimage $eid vimage -lr | fgrep -v " " | cut -d: -f 1} res] != 0 } {
+ if { [catch {nexec echo vimage $eid vimage -lr | fgrep -v " " | cut -d: -f 1} res] != 0 } {
return
}
set vimages [join $res]
set vrti 0
foreach vimage $vimages {
# puts "vimage $vimage...\n"
- while { [catch {nexec vimage $eid.$vimage netstat -an -f inet | fgrep "WAIT"} odg] == 0} {
+ while { [catch {nexec echo vimage $eid.$vimage netstat -an -f inet | fgrep "WAIT"} odg] == 0} {
set vrti 1
# puts "vimage $vimage: \n$odg\n"
after 2000
foreach vimage $vimages {
set stattxt "Terminating processes in vimage $vimage"
statline $stattxt
- catch {nexec vimage $eid.$vimage kill -9 -1 2> /dev/null}
+ catch {nexec echo vimage $eid.$vimage kill -9 -1 2> /dev/null}
}
# Detach / destroy / reassign interfaces pipe, eiface, iface, bridge
- set ngnodes [split [nexec vimage $eid ngctl l | tail -n +3] "
+ set ngnodes [split [nexec echo vimage $eid ngctl l | tail -n +3] "
"]
foreach ngline $ngnodes {
set node [lindex [eval list $ngline] 1]
statline "Shutting down netgraph node $node"
- catch "nexec vimage $eid ngctl msg $node: shutdown"
+ catch "nexec echo vimage $eid ngctl msg $node: shutdown"
}
# Shut down all vimages
foreach vimage $vimages {
set stattxt "Shutting down vimage $vimage"
statline $stattxt
- catch {nexec vimage $eid.$vimage kill -9 -1 2> /dev/null}
- while { [catch {nexec vimage -d $eid.$vimage}] } {
+ catch {nexec echo vimage $eid.$vimage kill -9 -1 2> /dev/null}
+ while { [catch {nexec echo vimage -d $eid.$vimage}] } {
set stattxt $stattxt.
statline $stattxt
- catch {nexec vimage $eid.$vimage kill -9 -1 2> /dev/null}
+ catch {nexec echo vimage $eid.$vimage kill -9 -1 2> /dev/null}
}
}
- catch { nexec vimage -d $eid }
+ catch { nexec echo vimage -d $eid }
catch { nexec rm -f /usr/local/etc/quagga/Quagga.conf }
nexec rm -fr "/tmp/$eid"
statline "Cleanup completed in [expr [clock seconds] - $t_start] seconds."
DRR { set qdisc drr }
}
set ngnode "$lnode1-$lnode2"
- if { [catch { nexec vimage $eid ngctl msg $ngnode: setcfg "{ $dir={ $qdisc=1 } }" }] } {
+ if { [catch { nexec echo vimage $eid ngctl msg $ngnode: setcfg "{ $dir={ $qdisc=1 } }" }] } {
set ngnode "$lnode2-$lnode1"
- nexec vimage $eid ngctl msg $ngnode: setcfg "{ $dir={ $qdisc=1 } }"
+ nexec echo vimage $eid ngctl msg $ngnode: setcfg "{ $dir={ $qdisc=1 } }"
}
}
drop-tail { set qdrop droptail }
}
set ngnode "$lnode1-$lnode2"
- if { [catch { nexec vimage $eid ngctl msg $ngnode: setcfg "{ $dir={ $qdrop=1 } }" }] } {
+ if { [catch { nexec echo vimage $eid ngctl msg $ngnode: setcfg "{ $dir={ $qdrop=1 } }" }] } {
# XXX dir should be reversed!
set ngnode "$lnode2-$lnode1"
- nexec vimage $eid ngctl msg $ngnode: setcfg "{ $dir={ $qdrop=1 } }"
+ nexec echo vimage $eid ngctl msg $ngnode: setcfg "{ $dir={ $qdrop=1 } }"
}
}
if { $qlen == 0 } {
set qlen -1
}
- if { [catch { nexec vimage $eid ngctl msg $ngnode: setcfg "{ $dir={ queuelen=$qlen } }" }] } {
+ if { [catch { nexec echo vimage $eid ngctl msg $ngnode: setcfg "{ $dir={ queuelen=$qlen } }" }] } {
set ngnode "$lnode2-$lnode1"
- nexec vimage $eid ngctl msg $ngnode: setcfg "{ $dir={ queuelen=$qlen } }"
+ nexec echo vimage $eid ngctl msg $ngnode: setcfg "{ $dir={ queuelen=$qlen } }"
}
}
set dup -1
}
- nexec vimage $eid ngctl msg $lname: setcfg \
+ nexec echo vimage $eid ngctl msg $lname: setcfg \
"{ bandwidth=$bandwidth delay=$delay \
upstream={ BER=$ber duplicate=$dup } \
downstream={ BER=$ber duplicate=$dup } }"