#****
proc createIfc { eid type hook } {
puts "usli u createIfc $eid $type $hook"
- return false
+ puts " izvrsili bismo exec printf mkpeer $type $hook $hook \n show .$hook | vimage $eid ngctl -f -"
+ puts " izvadili bi drugi element iz toga"
+ return fake_if_id
catch { exec printf "mkpeer $type $hook $hook \n show .$hook" | vimage $eid ngctl -f - } nglist
return [lindex $nglist 1]
}
#****
proc l3node.shutdown { eid node } {
set node_id "$eid\.$node"
- catch "nexec vimage $node_id kill -9 -1 2> /dev/null"
+ puts "nexec 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"
+ puts "nexec vimage $node_id ifconfig $ifc $ipv4 -alias"
}
foreach ipv6 [getIfcIPv6addr $node $ifc] {
- catch "nexec vimage $node_id ifconfig $ifc inet6 $ipv6 -alias"
+ puts "nexec 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 }
+ puts { nexec 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 }
+ puts { nexec vimage $eid ngctl msg hdlc$ifnum@$node_id: shutdown }
}
}
- catch {nexec vimage -d $node_id}
+ puts {nexec 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 rm -fr /tmp/$eid }
- catch { nexec mkdir /tmp/$eid }
-
- catch { nexec kldload ng_ether }
- catch { nexec kldload ng_iface }
- catch { nexec kldload ng_eiface }
- catch { nexec kldload ng_cisco }
- catch { nexec kldload ng_pipe }
- catch { nexec kldload ng_hub }
- catch { nexec kldload ng_bridge }
- catch { nexec kldload ng_socket }
+# na FreeBSD-u napravi jedan osnovni vimage unutar kojeg ce drzati
+# network peeringe izmedju nodeova
+# na Linuxu to necemo napraviti jer ne mozemo dirati network linkove
+# jednog VEa iz drugog, pa ce to sve biti na parent hostu
+ puts " nexec vimage -c $eid "
+ puts " nexec rm -fr /tmp/$eid "
+ puts " nexec mkdir /tmp/$eid "
+
+# puts { nexec kldload ng_ether }
+# puts { nexec kldload ng_iface }
+# puts { nexec kldload ng_eiface }
+# puts { nexec kldload ng_cisco }
+# puts { nexec kldload ng_pipe }
+# puts { nexec kldload ng_hub }
+# puts { nexec kldload ng_bridge }
+# puts { nexec kldload ng_socket }
foreach node $node_list {
set node_id "$eid\.$node"
# XXX race if starting two imunes instances simultaneously
nexec rm -fr /var/run/quagga
nexec rm -f /usr/local/etc/quagga/Quagga.conf
- catch { nexec ln -s /tmp/$eid/@ /var/run/quagga }
- catch { nexec ln -s /tmp/$eid/@/boot.conf /usr/local/etc/quagga/Quagga.conf }
+ puts { nexec ln -s /tmp/$eid/@ /var/run/quagga }
+ puts { nexec ln -s /tmp/$eid/@/boot.conf /usr/local/etc/quagga/Quagga.conf }
foreach file { bgpd ospfd ospf6d ripd ripngd vtysh zebra } {
- catch { nexec cp /dev/null /usr/local/etc/quagga/$file.conf }
+ puts { nexec cp /dev/null /usr/local/etc/quagga/$file.conf }
}
foreach node $node_list {
} else {
# wm title $wi "Please wait ..."
set w .timewait
- catch {destroy $w}
+ puts {destroy $w}
toplevel $w -takefocus 1
wm geometry $w +150+150
wm title $w "Please wait ..."
foreach vimage $vimages {
set stattxt "Terminating processes in vimage $vimage"
statline $stattxt
- catch {nexec vimage $eid.$vimage kill -9 -1 2> /dev/null}
+ puts {nexec vimage $eid.$vimage kill -9 -1 2> /dev/null}
}
# Detach / destroy / reassign interfaces pipe, eiface, iface, bridge
foreach ngline $ngnodes {
set node [lindex [eval list $ngline] 1]
statline "Shutting down netgraph node $node"
- catch "nexec vimage $eid ngctl msg $node: shutdown"
+ puts "nexec 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}
+ puts {nexec vimage $eid.$vimage kill -9 -1 2> /dev/null}
while { [catch {nexec vimage -d $eid.$vimage}] } {
set stattxt $stattxt.
statline $stattxt
- catch {nexec vimage $eid.$vimage kill -9 -1 2> /dev/null}
+ puts {nexec vimage $eid.$vimage kill -9 -1 2> /dev/null}
}
}
- catch { nexec vimage -d $eid }
- catch { nexec rm -f /usr/local/etc/quagga/Quagga.conf }
+ puts { nexec vimage -d $eid }
+ puts { nexec rm -f /usr/local/etc/quagga/Quagga.conf }
nexec rm -fr "/tmp/$eid"
statline "Cleanup completed in [expr [clock seconds] - $t_start] seconds."
}
proc closeFwrd { pid } {
global tcl_platform platform
if { $tcl_platform(platform) == "unix" } {
- catch {eval exec kill $pid}
+ puts {eval exec kill $pid}
return ""
}
}