From e61e599690be36bfb660a7fd21a637502452288c Mon Sep 17 00:00:00 2001 From: marko Date: Tue, 12 Jul 2005 07:48:31 +0000 Subject: [PATCH] Move node type specific shell command selection away from editor.tcl Bug found by: Submitted by: Requested by: Reviewed by: Approved by: Obtained from: --- editor.tcl | 32 +++----------------------------- host.tcl | 6 ++++++ hub.tcl | 5 +++++ lanswitch.tcl | 5 +++++ pc.tcl | 6 ++++++ quagga.tcl | 5 +++++ static.tcl | 6 ++++++ xorp.tcl | 5 +++++ 8 files changed, 41 insertions(+), 29 deletions(-) diff --git a/editor.tcl b/editor.tcl index a1dfe0a..1b9f4eb 100755 --- a/editor.tcl +++ b/editor.tcl @@ -796,30 +796,7 @@ proc button3 { c x y } { set node [lindex [$c gettags {node && current}] 1] set node_id $eid\_$node if { $node != "" && $oper_mode == "exec" } { - set cmd "" - set type [nodeType $node] - set model [getNodeModel $node] - switch -exact -- $type { - router { - switch -exact -- $model { - quagga { - set cmd "vtysh" - } - xorp { - set cmd "/usr/local/xorp/bin/xorpsh" - } - static { - set cmd "$env(SHELL)" - } - } - } - host { - set cmd "$env(SHELL)" - } - pc { - set cmd "$env(SHELL)" - } - } + set cmd [[typemodel $node].shellcmd $node] if { $cmd != "" } { exec xterm -sb -rightbar \ -T "IMUNES: [getNodeName $node] (console)" \ @@ -1606,11 +1583,11 @@ proc popupConfigDialog { c } { if {[lsearch {router pc host} $type] >= 0} { # - # Static IP routes + # Static routes # set routes [getStatIPv4routes $target] labelframe $wi.statrt -padx 4 -pady 4 - label $wi.statrt.label -text "Static IP routes:" + label $wi.statrt.label -text "Static routes:" pack $wi.statrt.label -side top -anchor w frame $wi.statrt.tab -width 10 frame $wi.statrt.tab1 -width 10 @@ -1624,9 +1601,6 @@ proc popupConfigDialog { c } { foreach route $routes { $wi.statrt.cfg.text insert end "$route " } - if { $model == "xorp" && $oper_mode != "edit" } { - $wi.statrt.cfg.text configure -state disabled - } pack $wi.statrt.cfg.text -expand yes pack $wi.statrt.tab $wi.statrt.cfg $wi.statrt.tab1 -side left pack $wi.statrt -side top -anchor w -fill both diff --git a/host.tcl b/host.tcl index 909db5b..b1cf303 100755 --- a/host.tcl +++ b/host.tcl @@ -67,6 +67,12 @@ proc host.bootcmd { node } { } +proc host.shellcmd { node } { + global env + return "$env(SHELL)" +} + + proc host.instantiate { eid node } { l3node.instantiate $eid $node return diff --git a/hub.tcl b/hub.tcl index d369b54..67646fc 100755 --- a/hub.tcl +++ b/hub.tcl @@ -51,3 +51,8 @@ proc hub.nghook { eid node ifc } { return [list $eid\_$node link$ifunit] } + +proc hub.shellcmd { node } { + return +} + diff --git a/lanswitch.tcl b/lanswitch.tcl index e5f8c98..fa25fc1 100755 --- a/lanswitch.tcl +++ b/lanswitch.tcl @@ -51,3 +51,8 @@ proc lanswitch.nghook { eid node ifc } { return [list $eid\_$node link$ifunit] } + +proc lanswitch.shellcmd { node } { + return +} + diff --git a/pc.tcl b/pc.tcl index 64e0049..df781ff 100755 --- a/pc.tcl +++ b/pc.tcl @@ -64,6 +64,12 @@ proc pc.bootcmd { node } { } +proc pc.shellcmd { node } { + global env + return "$env(SHELL)" +} + + proc pc.instantiate { eid node } { l3node.instantiate $eid $node return diff --git a/quagga.tcl b/quagga.tcl index 4f492f0..2b19f91 100755 --- a/quagga.tcl +++ b/quagga.tcl @@ -80,6 +80,11 @@ proc router.quagga.bootcmd { node } { } +proc router.quagga.shellcmd { node } { + return "vtysh" +} + + proc router.quagga.instantiate { eid node } { set node_id "$eid\_$node" l3node.instantiate $eid $node diff --git a/static.tcl b/static.tcl index 558205f..87bbec8 100755 --- a/static.tcl +++ b/static.tcl @@ -64,6 +64,12 @@ proc router.static.bootcmd { node } { } +proc router.static.shellcmd { node } { + global env + return "$env(SHELL)" +} + + proc router.static.instantiate { eid node } { set node_id "$eid\_$node" l3node.instantiate $eid $node diff --git a/xorp.tcl b/xorp.tcl index 2c50987..9f7af47 100755 --- a/xorp.tcl +++ b/xorp.tcl @@ -139,6 +139,11 @@ proc router.xorp.bootcmd { node } { } +proc router.xorp.shellcmd { node } { + return "/usr/local/xorp/bin/xorpsh" +} + + proc router.xorp.instantiate { eid node } { set node_id "$eid\_$node" l3node.instantiate $eid $node -- 2.39.5