-# $Id: editor.tcl,v 1.62.2.12 2007/09/03 12:00:29 marko Exp $
+# $Id: editor.tcl,v 1.62.2.13 2007/09/04 12:08:16 marko Exp $
#
# Copyright 2004, 2005 University of Zagreb, Croatia. All rights reserved.
#
return
}
switch -exact -- $object_type {
- #
- # Node
- #
node {
set type [nodeType $target]
set model [getNodeModel $target]
}
if {[[typemodel $target].layer] == "NETWORK"} {
- foreach ifc [ifcList $target] {
- #
- # Operational state
- #
- global [subst ifoper$ifc]
- set ifoperstate [subst $[subst ifoper$ifc]]
- set oldifoperstate [getIfcOperState $target $ifc]
- if { $ifoperstate != $oldifoperstate } {
- setIfcOperState $target $ifc $ifoperstate
- set changed 1
- }
+ foreach ifc [ifcList $target] {
+ #
+ # Operational state
+ #
+ global [subst ifoper$ifc]
+ set ifoperstate [subst $[subst ifoper$ifc]]
+ set oldifoperstate [getIfcOperState $target $ifc]
+ if { $ifoperstate != $oldifoperstate } {
+ setIfcOperState $target $ifc $ifoperstate
+ set changed 1
+ }
- #
- # IPv4 / IPv6 address & MTU
- #
- set ipaddr [$wi.if$ifc.cfg.ipv4.addrv get]
- set oldipaddr [getIfcIPv4addr $target $ifc]
- if { $ipaddr != $oldipaddr } {
- setIfcIPv4addr $target $ifc $ipaddr
- set changed 1
- }
- set ipaddr [$wi.if$ifc.cfg.ipv6.addrv get]
- set oldipaddr [getIfcIPv6addr $target $ifc]
- if { $ipaddr != $oldipaddr } {
- setIfcIPv6addr $target $ifc $ipaddr
- set changed 1
- }
+ #
+ # IPv4 / IPv6 address & MTU
+ #
+ set ipaddr [$wi.if$ifc.cfg.ipv4.addrv get]
+ set oldipaddr [getIfcIPv4addr $target $ifc]
+ if { $ipaddr != $oldipaddr } {
+ setIfcIPv4addr $target $ifc $ipaddr
+ set changed 1
+ }
+ set ipaddr [$wi.if$ifc.cfg.ipv6.addrv get]
+ set oldipaddr [getIfcIPv6addr $target $ifc]
+ if { $ipaddr != $oldipaddr } {
+ setIfcIPv6addr $target $ifc $ipaddr
+ set changed 1
+ }
- set mtu [$wi.if$ifc.label.mtuv get]
- set oldmtu [getIfcMTU $target $ifc]
- if { $mtu != $oldmtu } {
- setIfcMTU $target $ifc $mtu
- set changed 1
+ set mtu [$wi.if$ifc.label.mtuv get]
+ set oldmtu [getIfcMTU $target $ifc]
+ if { $mtu != $oldmtu } {
+ setIfcMTU $target $ifc $mtu
+ set changed 1
+ }
}
- }
-
- set oldIPv4statrtes [lsort [getStatIPv4routes $target]]
- set oldIPv6statrtes [lsort [getStatIPv6routes $target]]
- set newIPv4statrtes {}
- set newIPv6statrtes {}
- set i 1
- while { 1 } {
- set text [$wi.statrt.cfg.text get $i.0 $i.end]
- set rtentry [lrange [split [string trim $text]] 0 2]
- if { $rtentry == "" } {
- break
- }
- set dst [lindex $rtentry 0]
- set gw [lindex $rtentry 1]
- set metric [lindex $rtentry 2]
- if { [string is integer $metric] != 1 || $metric > 65535 } {
- break
- }
- if { [checkIPv4Net $dst] == 1 } {
- if { [checkIPv4Addr $gw] == 1 } {
- lappend newIPv4statrtes [string trim "$dst $gw $metric"]
- } else {
+ set oldIPv4statrtes [lsort [getStatIPv4routes $target]]
+ set oldIPv6statrtes [lsort [getStatIPv6routes $target]]
+ set newIPv4statrtes {}
+ set newIPv6statrtes {}
+ set i 1
+ while { 1 } {
+ set text [$wi.statrt.cfg.text get $i.0 $i.end]
+ set rtentry [lrange [split [string trim $text]] 0 2]
+ if { $rtentry == "" } {
+ break
+ }
+ set dst [lindex $rtentry 0]
+ set gw [lindex $rtentry 1]
+ set metric [lindex $rtentry 2]
+ if { [string is integer $metric] != 1 || $metric > 65535 } {
break
}
- } elseif { [checkIPv6Net $dst] == 1 } {
- if { [checkIPv6Addr $gw] == 1 } {
- lappend newIPv6statrtes [string trim "$dst $gw $metric"]
+ if { [checkIPv4Net $dst] == 1 } {
+ if { [checkIPv4Addr $gw] == 1 } {
+ lappend newIPv4statrtes [string trim "$dst $gw $metric"]
+ } else {
+ break
+ }
+ } elseif { [checkIPv6Net $dst] == 1 } {
+ if { [checkIPv6Addr $gw] == 1 } {
+ lappend newIPv6statrtes [string trim "$dst $gw $metric"]
+ } else {
+ break
+ }
} else {
break
}
- } else {
- break
+ incr i
+ }
+ set newIPv4statrtes [lsort $newIPv4statrtes]
+ if { $oldIPv4statrtes != $newIPv4statrtes } {
+ setStatIPv4routes $target $newIPv4statrtes
+ set changed 1
+ }
+ set newIPv6statrtes [lsort $newIPv6statrtes]
+ if { $oldIPv6statrtes != $newIPv6statrtes } {
+ setStatIPv6routes $target $newIPv6statrtes
+ set changed 1
}
- incr i
- }
- set newIPv4statrtes [lsort $newIPv4statrtes]
- if { $oldIPv4statrtes != $newIPv4statrtes } {
- setStatIPv4routes $target $newIPv4statrtes
- set changed 1
- }
- set newIPv6statrtes [lsort $newIPv6statrtes]
- if { $oldIPv6statrtes != $newIPv6statrtes } {
- setStatIPv6routes $target $newIPv6statrtes
- set changed 1
- }
- set oldcustomenabled [getCustomEnabled $target]
- if {$oldcustomenabled != $customEnabled} {
- setCustomEnabled $target $customEnabled
- set changed 1
- }
+ set oldcustomenabled [getCustomEnabled $target]
+ if {$oldcustomenabled != $customEnabled} {
+ setCustomEnabled $target $customEnabled
+ set changed 1
+ }
- if { $showIPsecConfig == 0 } {
- set ipsecEnabled 0
- }
- set oldipsecenabled [getIpsecEnabled $target]
- if {$oldipsecenabled != $ipsecEnabled} {
- setIpsecEnabled $target $ipsecEnabled
- set changed 1
- }
+ if { $showIPsecConfig == 0 } {
+ set ipsecEnabled 0
+ }
+ set oldipsecenabled [getIpsecEnabled $target]
+ if {$oldipsecenabled != $ipsecEnabled} {
+ setIpsecEnabled $target $ipsecEnabled
+ set changed 1
+ }
- set oldcpuconf [getNodeCPUConf $target]
- set newcpuconf {}
- set cpumin [$wi.cpu.mine get]
- set cpumax [$wi.cpu.maxe get]
- set cpuweight [$wi.cpu.weighte get]
- if { $cpumin != "" } {
- lappend newcpuconf "min $cpumin"
- }
- if { $cpumax != "" } {
- lappend newcpuconf "max $cpumax"
- }
- if { $cpuweight != "" } {
- lappend newcpuconf "weight $cpuweight"
- }
- if { $oldcpuconf != $newcpuconf } {
- setNodeCPUConf $target [list $newcpuconf]
- set changed 1
+ set oldcpuconf [getNodeCPUConf $target]
+ set newcpuconf {}
+ set cpumin [$wi.cpu.mine get]
+ set cpumax [$wi.cpu.maxe get]
+ set cpuweight [$wi.cpu.weighte get]
+ if { $cpumin != "" } {
+ lappend newcpuconf "min $cpumin"
+ }
+ if { $cpumax != "" } {
+ lappend newcpuconf "max $cpumax"
+ }
+ if { $cpuweight != "" } {
+ lappend newcpuconf "weight $cpuweight"
+ }
+ if { $oldcpuconf != $newcpuconf } {
+ setNodeCPUConf $target [list $newcpuconf]
+ set changed 1
+ }
}
- } # XXX node
}
- #
- # Link
- #
link {
set mirror [getLinkMirror $target]
set bw [$wi.bandwidth.value get]
if { $changed == 1 && $oper_mode == "exec" } {
execSetLinkParams $eid $target
}
- } # XXX link
+ }
}
if { $changed == 1 } {
redrawAll