# and Technology through the research contract #IP-2003-143.
#
-# $Id: editor.tcl,v 1.90 2008/05/17 01:57:02 marko Exp $
+# $Id: editor.tcl,v 1.91 2008/10/23 12:04:20 marko Exp $
#****h* imunes/editor.tcl
if { $x > [expr $x2-($x2-$x1)/8.0]} { set r 1 }
if { $y < [expr $y1+($y2-$y1)/8.0]} { set u 1 }
if { $y > [expr $y2-($y2-$y1)/8.0]} { set d 1 }
-
+
if {$l==1} {
if {$u==1} {
set resizemode lu
set lastX $x
set lastY $y
# actually we should check if curobj==bkgImage
- } elseif { $activetool == "oval" && \
- ( $curobj == $newoval || $curobj == $background || $curtype == "background" || $curtype == "grid")} {
+ } elseif { $activetool == "oval" && ( $curobj == $newoval \
+ || $curobj == $background || $curtype == "background" \
+ || $curtype == "grid")} {
# Draw a new oval
if {$newoval == ""} {
set newoval [$c create oval $lastX $lastY $x $y \
$lastX $lastY $x $y
}
# actually we should check if curobj==bkgImage
- } elseif { $activetool == "rectangle" && \
- ( $curobj == $newrect || $curobj == $background || $curtype == "background") || $curtype == "grid"} {
- # Draw a new rectangle
+ } elseif { $activetool == "rectangle" && ( $curobj == $newrect \
+ || $curobj == $background || $curtype == "background") \
+ || $curtype == "grid"} {
+ # Draw a new rectangle
if {$newrect == ""} {
set newrect [$c create rectangle $lastX $lastY $x $y \
-outline blue \
proc popupConfigDialog { c } {
upvar 0 ::cf::[set ::curcfg]::curcanvas curcanvas
upvar 0 ::cf::[set ::curcfg]::oper_mode oper_mode
- global activetool router_model link_color supp_router_models
- global badentry
-
+ global activetool link_color
+ global badentry
+ global ripEnable ripngEnable ospfEnable ospf6Enable
+ global router_ConfigModel
+ global wi
set wi .popup
catch {destroy $wi}
toplevel $wi
switchCanvas none
return
}
- set model [getNodeModel $target]
- set router_model $model
wm title $wi "$type configuration"
frame $wi.ftop -borderwidth 4
if { $type == "rj45" } {
$wi.ftop.name insert 0 [getNodeName $target]
pack $wi.ftop.name $wi.ftop.name_label -side right -padx 4 -pady 4
pack $wi.ftop -side top
+
if { $type == "router" } {
frame $wi.model -borderwidth 4
- label $wi.model.label -text "Model:"
- if { $oper_mode == "edit" } {
- eval tk_optionMenu $wi.model.menu router_model \
- $supp_router_models
+ label $wi.model.label -text "Model:"
+ frame $wi.protocols -borderwidth 4
+ label $wi.protocols.label -text "Protocols:"
+ checkbutton $wi.protocols.rip -text "rip" -variable ripEnable
+ checkbutton $wi.protocols.ripng -text "ripng" -variable ripngEnable
+ checkbutton $wi.protocols.ospf -text "ospfv2" -variable ospfEnable
+ checkbutton $wi.protocols.ospf6 -text "ospfv3" -variable ospf6Enable
+ radiobutton $wi.model.quagga -text quagga \
+ -variable router_ConfigModel -value quagga -command {
+ $wi.protocols.rip configure -state normal
+ $wi.protocols.ripng configure -state normal
+ $wi.protocols.ospf configure -state normal
+ $wi.protocols.ospf6 configure -state normal
+ }
+ radiobutton $wi.model.xorp -text xorp \
+ -variable router_ConfigModel -value xorp -command {
+ $wi.protocols.rip configure -state normal
+ $wi.protocols.ripng configure -state normal
+ $wi.protocols.ospf configure -state normal
+ $wi.protocols.ospf6 configure -state normal
+ }
+ radiobutton $wi.model.static -text static \
+ -variable router_ConfigModel -value static -command {
+ $wi.protocols.rip configure -state disabled
+ $wi.protocols.ripng configure -state disabled
+ $wi.protocols.ospf configure -state disabled
+ $wi.protocols.ospf6 configure -state disabled
+ }
+
+ set router_ConfigModel [getNodeModel $target]
+ if { $router_ConfigModel != "static" } {
+ set ripEnable [getNodeProtocolRip $target]
+ set ripngEnable [getNodeProtocolRipng $target]
+ set ospfEnable [getNodeProtocolOspfv2 $target]
+ set ospf6Enable [getNodeProtocolOspfv3 $target]
} else {
- tk_optionMenu $wi.model.menu router_model $model
- }
- pack $wi.model.menu $wi.model.label -side right -padx 0 -pady 0
- pack $wi.model -side top
+ $wi.protocols.rip configure -state disabled
+ $wi.protocols.ripng configure -state disabled
+ $wi.protocols.ospf configure -state disabled
+ $wi.protocols.ospf6 configure -state disabled
+ }
+ if { $oper_mode != "edit" } {
+ $wi.model.quagga configure -state disabled
+ $wi.model.xorp configure -state disabled
+ $wi.model.static configure -state disabled
+ $wi.protocols.rip configure -state disabled
+ $wi.protocols.ripng configure -state disabled
+ $wi.protocols.ospf configure -state disabled
+ $wi.protocols.ospf6 configure -state disabled
+ }
+
+ pack $wi.model -side top -fill x -pady 10
+ pack $wi.model.label -side left -padx 0 -pady 0
+ pack $wi.model.quagga $wi.model.xorp $wi.model.static \
+ -side left -expand 1
+ pack $wi.protocols -side top
+ pack $wi.protocols.label $wi.protocols.rip $wi.protocols.ripng \
+ $wi.protocols.ospf $wi.protocols.ospf6 -side left
}
if { $type != "rj45" } {
"popupConfigApply $wi $object_type $target 0"
focus $wi.butt.apply
button $wi.butt.cancel -text "Cancel" -command \
- "set badentry -1 ; destroy $wi"
+ "set badentry -1; destroy $wi"
pack $wi.butt.cancel $wi.butt.apply -side right
pack $wi.butt -side bottom
bind $wi <Key-Escape> "set badentry -1; destroy $wi"
frame $w.buttons
pack $w.buttons -side bottom
button $w.buttons.addccfg -text "Add new" \
- -command "customConfigApply $w $node 1"
+ -command "customConfigApply $w $node 1"
button $w.buttons.apply -text "Apply" \
-command "customConfigApply $w $node 0"
button $w.buttons.delete -text Delete -command \
proc popupConfigApply { wi object_type target phase } {
upvar 0 ::cf::[set ::curcfg]::oper_mode oper_mode
upvar 0 ::cf::[set ::curcfg]::eid eid
- global changed router_model link_color badentry
+ global changed link_color badentry
+ global router_ConfigModel
+ global ripEnable ripngEnable ospfEnable ospf6Enable
global customEnabled ipsecEnabled
global showIPsecConfig
setNodeName $target $name
set changed 1
}
- if { $oper_mode == "edit" && $type == "router" && \
- $router_model != $model } {
- setNodeModel $target $router_model
+ if { $oper_mode == "edit" && $type == "router"} {
+ setNodeModel $target $router_ConfigModel
+ if { $router_ConfigModel != "static" } {
+ setNodeProtocolRip $target $ripEnable
+ setNodeProtocolRipng $target $ripngEnable
+ setNodeProtocolOspfv2 $target $ospfEnable
+ setNodeProtocolOspfv3 $target $ospf6Enable
+ } else {
+ $wi.protocols.rip configure -state disabled
+ $wi.protocols.ripng configure -state disabled
+ $wi.protocols.ospf configure -state disabled
+ $wi.protocols.ospf6 configure -state disabled
+ }
set changed 1
- }
-
+ }
foreach ifc [ifcList $target] {
if { [nodeType [peerByIfc $target $ifc]] != "rj45" && \
[nodeType $target] != "rj45" } {
grab $w
}
+
#****f* editor.tcl/changeAddressRange
# NAME
# changeAddressRange -- change address range for selected nodes
# SYNOPSIS
# changeAddressRange
# FUNCTION
-#
-#
+#
+#
#****
proc changeAddressRange {} {
global changed
set selected_nodes [selectedNodes]
foreach node $selected_nodes {
foreach ifc [ifcList $node] {
- set peer [peerByIfc $node $ifc]
- if {[lsearch $selected_nodes $peer] != -1} {
- if {[string range $node 1 end] < [string range $peer 1 end]} {
+ set peer [peerByIfc $node $ifc]
+ if { [lsearch $selected_nodes $peer] != -1 } {
+ if { [string range $node 1 end] < [string range $peer 1 end] } {
set changeAddrRange 1
}
autoIPv4addr $node $ifc
set changed 1
set changeAddrRange 0
}
- }
+ }
}
redrawAll
updateUndoLog
}
+#****f* editor.tcl/routerDefaultsApply
+# NAME
+# routerDefaultsApply-- router defaults apply
+# SYNOPSIS
+# routerDefaultsApply $wi
+# FUNCTION
+# This procedure is called when the button aplly is pressed in
+# popup router defaults dialog box.
+# INPUTS
+# * w -- widget
+#****
+
+proc routerDefaultsApply { wi } {
+ upvar 0 ::cf::[set ::curcfg]::node_list node_list
+ upvar 0 ::cf::[set ::curcfg]::oper_mode oper_mode
+ global changed router_model routerDefaultsModel router_ConfigModel
+ global routerRipEnable routerRipngEnable routerOspfEnable routerOspf6Enable
+ global rdconfig
+
+ lset rdconfig 0 $routerRipEnable
+ lset rdconfig 1 $routerRipngEnable
+ lset rdconfig 2 $routerOspfEnable
+ lset rdconfig 3 $routerOspf6Enable
+ set routerDefaultsModel $router_model
+ set model quagga
+ set selected_node_list [selectedNodes]
+ set empty {}
+
+ if { $selected_node_list != $empty } {
+ foreach node $selected_node_list {
+ if { $oper_mode == "edit" } {
+ setNodeModel $node $router_model
+ set router_ConfigModel $router_model
+ if { $router_ConfigModel != "static" } {
+ set ripEnable [lindex $rdconfig 0]
+ set ripngEnable [lindex $rdconfig 1]
+ set ospfEnable [lindex $rdconfig 2]
+ set ospf6Enable [lindex $rdconfig 3]
+ setNodeProtocolRip $node $ripEnable
+ setNodeProtocolRipng $node $ripngEnable
+ setNodeProtocolOspfv2 $node $ospfEnable
+ setNodeProtocolOspfv3 $node $ospf6Enable
+ } else {
+ $wi.protocols.rip configure -state disabled
+ $wi.protocols.ripng configure -state disabled
+ $wi.protocols.ospf configure -state disabled
+ $wi.protocols.ospf6 configure -state disabled
+ }
+ set changed 1
+ }
+ }
+ } else {
+ foreach node $node_list {
+ if { $oper_mode == "edit" } {
+ setNodeModel $node $router_model
+ set router_ConfigModel $router_model
+ if { $router_ConfigModel != "static" } {
+ set ripEnable [lindex $rdconfig 0]
+ set ripngEnable [lindex $rdconfig 1]
+ set ospfEnable [lindex $rdconfig 2]
+ set ospf6Enable [lindex $rdconfig 3]
+ setNodeProtocolRip $node $ripEnable
+ setNodeProtocolRipng $node $ripngEnable
+ setNodeProtocolOspfv2 $node $ospfEnable
+ setNodeProtocolOspfv3 $node $ospf6Enable
+ } else {
+ $wi.protocols.rip configure -state disabled
+ $wi.protocols.ripng configure -state disabled
+ $wi.protocols.ospf configure -state disabled
+ $wi.protocols.ospf6 configure -state disabled
+ }
+ set changed 1
+ }
+ }
+ }
+
+ if { $changed == 1 } {
+ redrawAll
+ updateUndoLog
+ }
+ destroy $wi
+}
# and Technology through the research contract #IP-2003-143.
#
-# $Id: initgui.tcl,v 1.49 2008/05/17 01:57:02 marko Exp $
+# $Id: initgui.tcl,v 1.50 2008/10/23 12:04:20 marko Exp $
#****h* imunes/initgui.tcl
set supp_router_models "xorp quagga static"
set def_router_model quagga
+set model quagga
+set router_model $model
+set routerDefaultsModel $model
+set ripEnable 1
+set ripngEnable 1
+set ospfEnable 0
+set ospf6Enable 0
+set routerRipEnable 1
+set routerRipngEnable 1
+set routerOspfEnable 0
+set routerOspf6Enable 0
+set rdconfig [list $routerRipEnable $routerRipngEnable $routerOspfEnable $routerOspf6Enable]
#
# Window / canvas setup section
.menubar.edit add command -label "Select adjacent" \
-accelerator "Ctrl+N" -command selectAdjacent
bind . <Control-n> selectAdjacent
-
-
+
#
# Canvas
#
$w.e1 configure -vcmd {checkIPv4Net %P}
}
+.menubar.tools add command -label "Routing protocol defaults" -command {
+ upvar 0 ::cf::[set ::curcfg]::curcanvas curcanvas
+ upvar 0 ::cf::[set ::curcfg]::oper_mode oper_mode
+ global router_model supp_router_models routerDefaultsModel
+ global routerRipEnable routerRipngEnable routerOspfEnable routerOspf6Enable
+
+ set wi .popup
+ catch {destroy $wi}
+ toplevel $wi
+ wm transient $wi .
+ wm resizable $wi 0 0
+ wm title $wi "Router Defaults"
+
+ frame $wi.model -borderwidth 4
+ label $wi.model.label -text "Model:"
+ frame $wi.protocols -borderwidth 4
+ label $wi.protocols.label -text "Protocols:"
+ checkbutton $wi.protocols.rip -text "rip" -variable routerRipEnable
+ checkbutton $wi.protocols.ripng -text "ripng" -variable routerRipngEnable
+ checkbutton $wi.protocols.ospf -text "ospfv2" -variable routerOspfEnable
+ checkbutton $wi.protocols.ospf6 -text "ospfv3" -variable routerOspf6Enable
+ radiobutton $wi.model.quagga -text quagga -variable router_model \
+ -value quagga -command {
+ $wi.protocols.rip configure -state normal
+ $wi.protocols.ripng configure -state normal
+ $wi.protocols.ospf configure -state normal
+ $wi.protocols.ospf6 configure -state normal
+ }
+ radiobutton $wi.model.xorp -text xorp -variable router_model \
+ -value xorp -command {
+ $wi.protocols.rip configure -state normal
+ $wi.protocols.ripng configure -state normal
+ $wi.protocols.ospf configure -state normal
+ $wi.protocols.ospf6 configure -state normal
+ }
+ radiobutton $wi.model.static -text static -variable router_model \
+ -value static -command {
+ $wi.protocols.rip configure -state disabled
+ $wi.protocols.ripng configure -state disabled
+ $wi.protocols.ospf configure -state disabled
+ $wi.protocols.ospf6 configure -state disabled
+ }
+ if { $router_model == "static" || $oper_mode != "edit" } {
+ $wi.protocols.rip configure -state disabled
+ $wi.protocols.ripng configure -state disabled
+ $wi.protocols.ospf configure -state disabled
+ $wi.protocols.ospf6 configure -state disabled
+ }
+ if { $oper_mode != "edit" } {
+ $wi.model.quagga configure -state disabled
+ $wi.model.xorp configure -state disabled
+ $wi.model.static configure -state disabled
+ }
+
+ frame $wi.buttons
+ button $wi.buttons.b1 -text "Apply" -command { routerDefaultsApply $wi }
+ button $wi.buttons.b2 -text "Cancel" -command {
+ set router_model $routerDefaultsModel
+ set routerRipEnable [lindex $rdconfig 0]
+ set routerRipngEnable [lindex $rdconfig 1]
+ set routerOspfEnable [lindex $rdconfig 2]
+ set routerOspf6Enable [lindex $rdconfig 3]
+ destroy $wi
+ }
+
+ pack $wi.model -side top -fill x -pady 10
+ pack $wi.model.label -side left -padx 0 -pady 0
+ pack $wi.model.quagga $wi.model.xorp $wi.model.static \
+ -side left -expand 1
+ pack $wi.protocols -side top
+ pack $wi.protocols.label $wi.protocols.rip $wi.protocols.ripng \
+ $wi.protocols.ospf $wi.protocols.ospf6 -side left
+ pack $wi.buttons -side bottom -fill x -pady 2m
+ pack $wi.buttons.b1 $wi.buttons.b2 -side left -expand 1
+}
.menubar.tools add separator
.menubar.tools add command -label "ns2imunes converter" \
-underline 0 -command {
- toplevel .ns2im-dialog
- wm title .ns2im-dialog "ns2imunes converter"
-
- set f1 [frame .ns2im-dialog.entry1]
- set f2 [frame .ns2im-dialog.buttons]
+ toplevel .ns2im-dialog
+ wm title .ns2im-dialog "ns2imunes converter"
- label $f1.l -text "ns2 file:"
- entry $f1.e -width 25 -textvariable ns2srcfile
- button $f1.b -text "Browse" -width 8 \
- -command {
- set srcfile [tk_getOpenFile -parent .ns2im-dialog \
- -initialfile $ns2srcfile]
- $f1.e delete 0 end
- $f1.e insert 0 "$srcfile"
- }
- button $f2.b1 -text "OK" -command {
- ns2im $srcfile
- destroy .ns2im-dialog
- }
- button $f2.b2 -text "Cancel" -command { destroy .ns2im-dialog}
+ set f1 [frame .ns2im-dialog.entry1]
+ set f2 [frame .ns2im-dialog.buttons]
- pack $f1.b $f1.e -side right
- pack $f1.l -side right -fill x -expand true
- pack $f2.b1 -side left -expand true -anchor e
- pack $f2.b2 -side left -expand true -anchor w
- pack $f1 $f2 -fill x
+ label $f1.l -text "ns2 file:"
+ entry $f1.e -width 25 -textvariable ns2srcfile
+ button $f1.b -text "Browse" -width 8 \
+ -command {
+ set srcfile [tk_getOpenFile -parent .ns2im-dialog \
+ -initialfile $ns2srcfile]
+ $f1.e delete 0 end
+ $f1.e insert 0 "$srcfile"
+ }
+ button $f2.b1 -text "OK" -command {
+ ns2im $srcfile
+ destroy .ns2im-dialog
}
+ button $f2.b2 -text "Cancel" -command { destroy .ns2im-dialog}
+
+ pack $f1.b $f1.e -side right
+ pack $f1.l -side right -fill x -expand true
+ pack $f2.b1 -side left -expand true -anchor e
+ pack $f2.b2 -side left -expand true -anchor w
+ pack $f1 $f2 -fill x
+}
#
# and Technology through the research contract #IP-2003-143.
#
-# $Id: nodecfg.tcl,v 1.22 2008/01/02 12:08:46 marko Exp $
+# $Id: nodecfg.tcl,v 1.23 2008/10/23 12:04:20 marko Exp $
#****h* imunes/nodecfg.tcl
if { $addccfg == 0 && $delete == 0 } {
set $node [lreplace [set $node] $i $i]
} elseif { $addccfg == 0 && $delete == 1 } {
- if { $cid == $id } {
- set $node [lreplace [set $node] $i $i]
- }
+ if { $cid == $id } {
+ set $node [lreplace [set $node] $i $i]
+ }
} else {
- if { $cid == $id } {
- set warning "Choose another custom config id!"
- tk_messageBox -message $warning -type ok -icon warning \
- -title "Custom configuration id warning"
- set $node [lreplace [set $node] $i $i]
- }
+ if { $cid == $id } {
+ set warning "Choose another custom config id!"
+ tk_messageBox -message $warning -type ok -icon warning \
+ -title "Custom configuration id warning"
+ set $node [lreplace [set $node] $i $i]
+ }
}
}
proc newNode { type } {
upvar 0 ::cf::[set ::curcfg]::node_list node_list
- global def_router_model
+ global ripEnable ripngEnable ospfEnable ospf6Enable
+ global rdconfig router_model router_ConfigModel
+ global def_router_model
global viewid
catch {unset viewid}
+ set ripEnable [lindex $rdconfig 0]
+ set ripngEnable [lindex $rdconfig 1]
+ set ospfEnable [lindex $rdconfig 2]
+ set ospf6Enable [lindex $rdconfig 3]
+ set router_ConfigModel $router_model
+
set node [newObjectId node]
upvar 0 ::cf::[set ::curcfg]::$node $node
set $node {}
lappend $node "type $type"
if { $type == "router" } {
- lappend $node "model $def_router_model"
+ if { $router_model != $def_router_model } {
+ lappend $node "model $router_model"
+ } else {
+ lappend $node "model $def_router_model"
+ }
set nconfig [list \
"hostname $node" \
- ! \
+ ! ]
+ if { $ripEnable == 1 } {
+ lappend nconfig \
"router rip" \
" redistribute static" \
" redistribute connected" \
" network 0.0.0.0/0" \
- ! \
+ !
+ }
+ if { $ripngEnable == 1 } {
+ lappend nconfig \
"router ripng" \
" redistribute static" \
" redistribute connected" \
" network ::/0" \
- ! ]
+ !
+ }
+ if { $ospfEnable == 1 } {
+ lappend nconfig \
+ "router ospf" \
+ " redistribute static" \
+ " redistribute connected" \
+ " network 0.0.0.0/0" \
+ !
+ }
+ if { $ospf6Enable == 1 } {
+ lappend nconfig \
+ "router ospf6" \
+ " redistribute static" \
+ " redistribute connected" \
+ " network ::/0" \
+ !
+ }
} elseif {$type == "rj45"} {
set nconfig [list \
"hostname UNASSIGNED" \
! ]
- } else {
- set nconfig [list \
+ } else {
+ set nconfig [list \
"hostname $node" \
! ]
}
}
}
+#****f* nodecfg.tcl/getNodeProtocolRip
+# NAME
+# getNodeProtocolRip
+# SYNOPSIS
+# getNodeProtocolRip $node_id
+# FUNCTION
+# checks if node's current protocol is rip.
+# INPUTS
+# * node_id -- node id
+#****
+
+proc getNodeProtocolRip { node } {
+ upvar 0 ::cf::[set ::curcfg]::$node $node
+
+ if { [netconfFetchSection $node "router rip"] == "{ redistribute static} { redistribute connected} { network 0.0.0.0/0}" } {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+#****f* nodecfg.tcl/getNodeProtocolRipng
+# NAME
+# getNodeProtocolRipng
+# SYNOPSIS
+# getNodeProtocolRipng $node_id
+# FUNCTION
+# checks if node's current protocol is ripng.
+# INPUTS
+# * node_id -- node id
+#****
+
+proc getNodeProtocolRipng { node } {
+ upvar 0 ::cf::[set ::curcfg]::$node $node
+
+ if { [netconfFetchSection $node "router ripng"] == "{ redistribute static} { redistribute connected} { network ::/0}" } {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+#****f* nodecfg.tcl/getNodeProtocolOspfv2
+# NAME
+# getNodeProtocolOspfv2
+# SYNOPSIS
+# getNodeProtocolOspfv2 $node_id
+# FUNCTION
+# checks if node's current protocol is ospfv2.
+# INPUTS
+# * node_id -- node id
+#****
+
+proc getNodeProtocolOspfv2 { node } {
+ upvar 0 ::cf::[set ::curcfg]::$node $node
+
+ if { [netconfFetchSection $node "router ospf"] == "{ redistribute static} { redistribute connected} { network 0.0.0.0/0}"} {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+#****f* nodecfg.tcl/getNodeProtocolOspfv3
+# NAME
+# getNodeProtocolOspfv3
+# SYNOPSIS
+# getNodeProtocolOspfv3 $node_id
+# FUNCTION
+# checks if node's current protocol is ospfv3.
+# INPUTS
+# * node_id -- node id
+#****
+
+proc getNodeProtocolOspfv3 { node } {
+ upvar 0 ::cf::[set ::curcfg]::$node $node
+
+ if { [netconfFetchSection $node "router ospf6"] == "{ redistribute static} { redistribute connected} { network ::/0}"} {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+#****f* nodecfg.tcl/setNodeProtocolRip
+# NAME
+# setNodeProtocolRip
+# SYNOPSIS
+# setNodeProtocolRip $node_id $ripEnable
+# FUNCTION
+# Sets node's protocol to rip.
+# INPUTS
+# * node_id -- node id
+# * ripEnable -- 1 if enabling rip, 0 if disabling
+#****
+
+proc setNodeProtocolRip { node ripEnable} {
+ upvar 0 ::cf::[set ::curcfg]::$node $node
+
+ if { $ripEnable == 1 } {
+ netconfInsertSection $node [list "router rip" \
+ " redistribute static" \
+ " redistribute connected" \
+ " network 0.0.0.0/0" \
+ ! ]
+ } else {
+ netconfClearSection $node "router rip"
+ }
+}
+
+#****f* nodecfg.tcl/setNodeProtocolRipng
+# NAME
+# setNodeProtocolRipng
+# SYNOPSIS
+# setNodeProtocolRipng $node_id $ripngEnable
+# FUNCTION
+# Sets node's protocol to ripng.
+# INPUTS
+# * node_id -- node id
+# * ripngEnable -- 1 if enabling ripng, 0 if disabling
+#****
+
+proc setNodeProtocolRipng { node ripngEnable} {
+ upvar 0 ::cf::[set ::curcfg]::$node $node
+
+ if { $ripngEnable == 1 } {
+ netconfInsertSection $node [list "router ripng" \
+ " redistribute static" \
+ " redistribute connected" \
+ " network ::/0" \
+ ! ]
+ } else {
+ netconfClearSection $node "router ripng"
+ }
+}
+
+#****f* nodecfg.tcl/setNodeProtocolOspfv2
+# NAME
+# setNodeProtocolOspfv2
+# SYNOPSIS
+# setNodeProtocolOspfv2 $node_id $ospfEnable
+# FUNCTION
+# Sets node's protocol to ospf.
+# INPUTS
+# * node_id -- node id
+# * ospfEnable -- 1 if enabling ospf, 0 if disabling
+#****
+
+proc setNodeProtocolOspfv2 { node ospfEnable} {
+ upvar 0 ::cf::[set ::curcfg]::$node $node
+
+ if { $ospfEnable == 1 } {
+ netconfInsertSection $node [list "router ospf" \
+ " redistribute static" \
+ " redistribute connected" \
+ " network 0.0.0.0/0" \
+ ! ]
+ } else {
+ netconfClearSection $node "router ospf"
+ }
+}
+
+#****f* nodecfg.tcl/setNodeProtocolOspfv3
+# NAME
+# setNodeProtocolOspfv3
+# SYNOPSIS
+# setNodeProtocolOspfv3 $node_id $ospf6Enable
+# FUNCTION
+# Sets node's protocol to Ospfv3.
+# INPUTS
+# * node_id -- node id
+# * ospf6Enable -- 1 if enabling ospf6, 0 if disabling
+#****
+
+proc setNodeProtocolOspfv3 { node ospf6Enable} {
+ upvar 0 ::cf::[set ::curcfg]::$node $node
+
+ if { $ospf6Enable == 1 } {
+ netconfInsertSection $node [list "router ospf6" \
+ " redistribute static" \
+ " redistribute connected" \
+ " network ::/0" \
+ ! ]
+ } else {
+ netconfClearSection $node "router ospf6"
+ }
+}
#****f* nodecfg.tcl/setNodeType
# NAME