]> git.entuzijast.net Git - imunes.git/commitdiff
Move node type specific shell command selection away from editor.tcl
authormarko <marko>
Tue, 12 Jul 2005 07:48:31 +0000 (07:48 +0000)
committermarko <marko>
Tue, 12 Jul 2005 07:48:31 +0000 (07:48 +0000)
Bug found by:
Submitted by:
Requested by:
Reviewed by:
Approved by:
Obtained from:

editor.tcl
host.tcl
hub.tcl
lanswitch.tcl
pc.tcl
quagga.tcl
static.tcl
xorp.tcl

index a1dfe0a7fc91ac2616f7e7fe2af0e1b51777d9b8..1b9f4eb1c382704a186a581e5120a1b406865a84 100755 (executable)
@@ -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\r"
                }
-               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
index 909db5b3233f6f383d758aa77827628c1916bfdb..b1cf30310bc1804a94a626b8b52c69a811187289 100755 (executable)
--- 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 d369b54c6c2bb5f29e66b2e866c6f6dad79a34e6..67646fc96974b6d2460cbb6a98dbebebc4b44412 100755 (executable)
--- 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
+}
+
index e5f8c98fd1f1826d64d5d0c81074d13754a93cea..fa25fc1e35bc91869cfa79558d925fc1b25c48ba 100755 (executable)
@@ -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 64e0049cc21589e53bfbf4110bbf25f4e903d686..df781ff9da98d0f89ad7900539349925870ccdcf 100755 (executable)
--- 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
index 4f492f035c78a4b41135a241496650eeecc40d1c..2b19f91d75e9fb6f8c295cfe13899012fa2274cd 100755 (executable)
@@ -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
index 558205fa64dff01590c0f2a94283ffab0400e197..87bbec87b84fcce5ea5953d2af71e6a794e8c349 100755 (executable)
@@ -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
index 2c50987fbb726e9a6091970db141ee3100c80f6a..9f7af47c27cd2c4d1d63b444c41fa2f73ae96614 100755 (executable)
--- 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