From dbd023f3595a72c8de316b64472f29c7732d1a46 Mon Sep 17 00:00:00 2001 From: marko Date: Tue, 12 Jul 2005 08:16:13 +0000 Subject: [PATCH] Change procedure definitions in type-specific modules from (example) host.bootcmd to $MODULE.bootcmd -> makes copy & paste from one module to another less labor intensive. Bug found by: Submitted by: Requested by: Reviewed by: Approved by: Obtained from: --- host.tcl | 12 +++++++----- hub.tcl | 9 ++++++--- lanswitch.tcl | 9 ++++++--- pc.tcl | 13 ++++++++----- quagga.tcl | 14 ++++++++------ static.tcl | 13 ++++++++----- xorp.tcl | 13 ++++++++----- 7 files changed, 51 insertions(+), 32 deletions(-) diff --git a/host.tcl b/host.tcl index b1cf303..c3a25c6 100755 --- a/host.tcl +++ b/host.tcl @@ -34,7 +34,9 @@ # -proc host.cfggen { node } { +set MODULE host + +proc $MODULE.cfggen { node } { global $node set cfg {} @@ -62,24 +64,24 @@ proc host.cfggen { node } { } -proc host.bootcmd { node } { +proc $MODULE.bootcmd { node } { return "/bin/sh" } -proc host.shellcmd { node } { +proc $MODULE.shellcmd { node } { global env return "$env(SHELL)" } -proc host.instantiate { eid node } { +proc $MODULE.instantiate { eid node } { l3node.instantiate $eid $node return } -proc host.nghook { eid node ifc } { +proc $MODULE.nghook { eid node ifc } { return [l3node.nghook $eid $node $ifc] } diff --git a/hub.tcl b/hub.tcl index 67646fc..9907d4a 100755 --- a/hub.tcl +++ b/hub.tcl @@ -34,7 +34,10 @@ # -proc hub.instantiate { eid node } { +set MODULE hub + + +proc $MODULE.instantiate { eid node } { catch {exec ngctl mkpeer hub anchor anchor | tail -1} resp foreach elem [split [lindex [split $resp "\{\}"] 1]] { if {[string equal -length 5 $elem "id=0x"]} { @@ -46,13 +49,13 @@ proc hub.instantiate { eid node } { } -proc hub.nghook { eid node ifc } { +proc $MODULE.nghook { eid node ifc } { set ifunit [string range $ifc 1 end] return [list $eid\_$node link$ifunit] } -proc hub.shellcmd { node } { +proc $MODULE.shellcmd { node } { return } diff --git a/lanswitch.tcl b/lanswitch.tcl index fa25fc1..e555102 100755 --- a/lanswitch.tcl +++ b/lanswitch.tcl @@ -34,7 +34,10 @@ # -proc lanswitch.instantiate { eid node } { +set MODULE lanswitch + + +proc $MODULE.instantiate { eid node } { catch {exec ngctl mkpeer bridge anchor anchor | tail -1} resp foreach elem [split [lindex [split $resp "\{\}"] 1]] { if {[string equal -length 5 $elem "id=0x"]} { @@ -46,13 +49,13 @@ proc lanswitch.instantiate { eid node } { } -proc lanswitch.nghook { eid node ifc } { +proc $MODULE.nghook { eid node ifc } { set ifunit [string range $ifc 1 end] return [list $eid\_$node link$ifunit] } -proc lanswitch.shellcmd { node } { +proc $MODULE.shellcmd { node } { return } diff --git a/pc.tcl b/pc.tcl index df781ff..236b55c 100755 --- a/pc.tcl +++ b/pc.tcl @@ -34,7 +34,10 @@ # -proc pc.cfggen { node } { +set MODULE pc + + +proc $MODULE.cfggen { node } { global $node set cfg {} @@ -59,24 +62,24 @@ proc pc.cfggen { node } { } -proc pc.bootcmd { node } { +proc $MODULE.bootcmd { node } { return "/bin/sh" } -proc pc.shellcmd { node } { +proc $MODULE.shellcmd { node } { global env return "$env(SHELL)" } -proc pc.instantiate { eid node } { +proc $MODULE.instantiate { eid node } { l3node.instantiate $eid $node return } -proc pc.nghook { eid node ifc } { +proc $MODULE.nghook { eid node ifc } { return [l3node.nghook $eid $node $ifc] } diff --git a/quagga.tcl b/quagga.tcl index 2b19f91..82e580e 100755 --- a/quagga.tcl +++ b/quagga.tcl @@ -34,7 +34,10 @@ # -proc router.quagga.cfggen { node } { +set MODULE router.quagga + + +proc $MODULE.cfggen { node } { global $node set cfg {} @@ -53,7 +56,6 @@ proc router.quagga.cfggen { node } { lappend cfg " shutdown" } lappend cfg "!" -#exec vimage $node ifconfig $ifc [getIfcOperState $node $ifc] # XXX!!! } foreach proto { rip ripng ospf bgp } { @@ -74,18 +76,18 @@ proc router.quagga.cfggen { node } { } -proc router.quagga.bootcmd { node } { +proc $MODULE.bootcmd { node } { global ROOTDIR LIBDIR return "$ROOTDIR/$LIBDIR/quaggaboot.sh" } -proc router.quagga.shellcmd { node } { +proc $MODULE.shellcmd { node } { return "vtysh" } -proc router.quagga.instantiate { eid node } { +proc $MODULE.instantiate { eid node } { set node_id "$eid\_$node" l3node.instantiate $eid $node exec vimage $node_id sysctl net.inet.ip.forwarding=1 @@ -93,7 +95,7 @@ proc router.quagga.instantiate { eid node } { } -proc router.quagga.nghook { eid node ifc } { +proc $MODULE.nghook { eid node ifc } { return [l3node.nghook $eid $node $ifc] } diff --git a/static.tcl b/static.tcl index 87bbec8..a948592 100755 --- a/static.tcl +++ b/static.tcl @@ -34,7 +34,10 @@ # -proc router.static.cfggen { node } { +set MODULE router.static + + +proc $MODULE.cfggen { node } { global $node set cfg {} @@ -59,18 +62,18 @@ proc router.static.cfggen { node } { } -proc router.static.bootcmd { node } { +proc $MODULE.bootcmd { node } { return "/bin/sh" } -proc router.static.shellcmd { node } { +proc $MODULE.shellcmd { node } { global env return "$env(SHELL)" } -proc router.static.instantiate { eid node } { +proc $MODULE.instantiate { eid node } { set node_id "$eid\_$node" l3node.instantiate $eid $node exec vimage $node_id sysctl net.inet.ip.forwarding=1 @@ -78,7 +81,7 @@ proc router.static.instantiate { eid node } { } -proc router.static.nghook { eid node ifc } { +proc $MODULE.nghook { eid node ifc } { return [l3node.nghook $eid $node $ifc] } diff --git a/xorp.tcl b/xorp.tcl index 9f7af47..4614f01 100755 --- a/xorp.tcl +++ b/xorp.tcl @@ -34,7 +34,10 @@ # -proc router.xorp.cfggen { node } { +set MODULE router.xorp + + +proc $MODULE.cfggen { node } { global $node set cfg {} @@ -134,17 +137,17 @@ proc router.xorp.cfggen { node } { } -proc router.xorp.bootcmd { node } { +proc $MODULE.bootcmd { node } { return "/usr/local/xorp/bin/xorp_rtrmgr -b" } -proc router.xorp.shellcmd { node } { +proc $MODULE.shellcmd { node } { return "/usr/local/xorp/bin/xorpsh" } -proc router.xorp.instantiate { eid node } { +proc $MODULE.instantiate { eid node } { set node_id "$eid\_$node" l3node.instantiate $eid $node exec vimage $node_id sysctl net.inet.ip.forwarding=1 @@ -152,7 +155,7 @@ proc router.xorp.instantiate { eid node } { } -proc router.xorp.nghook { eid node ifc } { +proc $MODULE.nghook { eid node ifc } { return [l3node.nghook $eid $node $ifc] } -- 2.39.5