Commit 23142383 authored by Shashi Guruprasad's avatar Shashi Guruprasad
Browse files

more fixes for silly mistakes

parent 71a142e1
......@@ -30,10 +30,9 @@ proc getipaddr {name} {
# returns the interface name for ipaddr
proc getmac {ipaddr} {
if { [catch {set ifconf [exec tmcc ifconfig]} errMsg] == 1 } {
puts stderr "NSE: tmcc ifconfig: $errMsg"
exit 1
}
set tmccifconfig [open /etc/testbed/tmcc.ifconfig r]
set ifconf [read $tmccifconfig]
close $tmccifconfig
set ifconfiglist [split $ifconf "\n"]
foreach ifconfig $ifconfiglist {
scan $ifconfig "INTERFACE=%s INET=%s MASK=%s MAC=%s " iface inet mask mac
......@@ -46,11 +45,9 @@ proc getmac {ipaddr} {
return ""
}
# assume PATH properly set by wrapper script
if { [catch {set nseconfig [exec tmcc nseconfigs]} errMsg] == 1 } {
puts stderr "NSE: tmcc nseconfigs: $errMsg"
exit 2
}
set tmccnseconfigs [open /etc/testbed/tmcc.nseconfigs r]
set nseconfig [read $tmccnseconfigs]
close $tmccnseconfigs
# If there is no nseconfig associated with this
# node, then we just give up
......@@ -70,6 +67,11 @@ if { [catch {eval $nseconfig} errMsg] == 1 } {
# the name of the simulator instance variable might not
# always be 'ns', coming from the TB parser
set ns [Simulator instance]
# we only need 1 RAW IP socket for introducing packets into the network
set ipnet [new Network/IP]
$ipnet open writeonly
# configuring NSE FullTcp traffic generators
set objnamelist ""
if { $nsetrafgen_present == 1 } {
......@@ -132,72 +134,66 @@ if { $nsetrafgen_present == 1 } {
lappend objnamelist [$telnetobj set objname]
}
}
}
# for each entry in `tmcc trafgens` that has NSE as the generator
# configure that object to connect to a newly created
# TCPTap along with the required Live and RAW IP objects. Set the filter and interface
# after learning it from tmcc commands and other scripts in /etc/testbed
# we only need 1 RAW IP socket for introducing packets into the network
set ipnet [new Network/IP]
$ipnet open writeonly
# configuring NSE FullTcp traffic generators
if { [catch {set tmcctrafgens [exec tmcc trafgens]} errMsg] == 1 } {
puts stderr "NSE: tmcc trafgens: $errMsg"
exit 3
}
set trafgenlist [split $tmcctrafgens "\n"]
set formatstr {TRAFGEN=%s MYNAME=%s MYPORT=%u PEERNAME=%s PEERPORT=%u PROTO=%s ROLE=%s GENERATOR=%s}
variable i 0
foreach trafgen $trafgenlist {
scan $trafgen $formatstr trafgen myname myport peername peerport proto role gen
if { $gen != "NSE" || $proto != "tcp" } {
continue
}
# for each entry in `tmcc trafgens` that has NSE as the generator
# configure that object to connect to a newly created
# TCPTap along with the required Live and RAW IP objects. Set the filter and interface
# after learning it from tmcc commands and other scripts in /etc/testbed
# if the variable in $trafgen exists, we create a bunch of taps
# first do the tap part
if { [info exists $trafgen] == 1 } {
# convert myname and peername to corresponding ipaddresses
# using the getipaddr helper subroutine
set myipaddr [getipaddr $myname]
set peeripaddr [getipaddr $peername]
# find interface name with a helper subroutine
set interface [getmac $myipaddr]
# one TCPTap object per TCP class that we have instantiated
set tcptap($i) [new Agent/TCPTap]
$tcptap($i) nsipaddr $myipaddr
$tcptap($i) nsport $myport
$tcptap($i) extipaddr $peeripaddr
$tcptap($i) extport $peerport
# open the bpf, set the filter for capturing incoming packets towards
# the current tcp object
set bpf_tcp($i) [new Network/Pcap/Live]
set dev_tcp($i) [$bpf_tcp($i) open readonly $interface]
$bpf_tcp($i) filter "tcp and dst $myipaddr and dst port $myport and src $peeripaddr and src port $peerport"
# associate the 2 network objects in the TCPTap object
$tcptap($i) network-incoming $bpf_tcp($i)
$tcptap($i) network-outgoing $ipnet
# attach the TCPTap agent to node n1
$ns attach-agent $n1 $tcptap($i)
# connect this tap and the particular tcp agent
set tcpagent($i) [expr \$$trafgen]
$ns connect $tcpagent($i) $tcptap($i)
incr i
set tmcctrafgens [open /etc/testbed/tmcc.trafgens r]
set tmcctraf [read $tmcctrafgens]
close $tmcctrafgens
set trafgenlist [split $tmcctraf "\n"]
set formatstr {TRAFGEN=%s MYNAME=%s MYPORT=%u PEERNAME=%s PEERPORT=%u PROTO=%s ROLE=%s GENERATOR=%s}
variable i 0
foreach trafgen $trafgenlist {
scan $trafgen $formatstr trafgen myname myport peername peerport proto role gen
if { $gen != "NSE" || $proto != "tcp" } {
continue
}
# if the variable in $trafgen exists, we create a bunch of taps
# first do the tap part
if { [info exists $trafgen] == 1 } {
# convert myname and peername to corresponding ipaddresses
# using the getipaddr helper subroutine
set myipaddr [getipaddr $myname]
set peeripaddr [getipaddr $peername]
# find interface name with a helper subroutine
set interface [getmac $myipaddr]
# one TCPTap object per TCP class that we have instantiated
set tcptap($i) [new Agent/TCPTap]
$tcptap($i) nsipaddr $myipaddr
$tcptap($i) nsport $myport
$tcptap($i) extipaddr $peeripaddr
$tcptap($i) extport $peerport
# open the bpf, set the filter for capturing incoming packets towards
# the current tcp object
set bpf_tcp($i) [new Network/Pcap/Live]
set dev_tcp($i) [$bpf_tcp($i) open readonly $interface]
$bpf_tcp($i) filter "tcp and dst $myipaddr and dst port $myport and src $peeripaddr and src port $peerport"
# associate the 2 network objects in the TCPTap object
$tcptap($i) network-incoming $bpf_tcp($i)
$tcptap($i) network-outgoing $ipnet
# attach the TCPTap agent to node n1_FullTcp
$ns attach-agent $n1_FullTcp $tcptap($i)
# connect this tap and the particular tcp agent
set tcpagent($i) [expr \$$trafgen]
$ns connect $tcpagent($i) $tcptap($i)
incr i
}
}
}
if { $simcode_present == 1 } {
......@@ -240,20 +236,24 @@ if { $simcode_present == 1 } {
}
# get some params to configure the event system interface
#set boss [lindex [split [exec tmcc bossinfo] " "] 0]
#set pideidlist [split [exec hostname] "."]
#set vnode [lindex $pideidlist 0]
#set eid [lindex $pideidlist 1]
#set pid [lindex $pideidlist 2]
#set logpath "/proj/$pid/exp/$eid/logs/nse-$vnode.log"
#if { $objnamelist != {} } {
# Configuring the Scheduler to monitor the event system
# set evsink [new TbEventSink]
# $evsink event-server "elvin://$boss"
# $evsink objnamelist [join $objnamelist ","]
# $evsink logfile $logpath
# [$ns set scheduler_] tbevent-sink $evsink
#}
if { $objnamelist != {} } {
set tmccbossinfo [open /etc/testbed/tmcc.bossinfo r]
set tmccboss [read $tmccbossinfo]
close $tmccbossinfo
set boss [lindex [split $tmccboss " "] 0]
set pideidlist [split [exec hostname] "."]
set vnode [lindex $pideidlist 0]
set eid [lindex $pideidlist 1]
set pid [lindex $pideidlist 2]
set logpath "/proj/$pid/exp/$eid/logs/nse-$vnode.log"
# Configuring the Scheduler to monitor the event system
set evsink [new TbEventSink]
$evsink event-server "elvin://$boss"
$evsink objnamelist [join $objnamelist ","]
$evsink logfile $logpath
[$ns set scheduler_] tbevent-sink $evsink
}
$ns run
......@@ -30,10 +30,9 @@ proc getipaddr {name} {
# returns the interface name for ipaddr
proc getmac {ipaddr} {
if { [catch {set ifconf [exec tmcc ifconfig]} errMsg] == 1 } {
puts stderr "NSE: tmcc ifconfig: $errMsg"
exit 1
}
set tmccifconfig [open /etc/testbed/tmcc.ifconfig r]
set ifconf [read $tmccifconfig]
close $tmccifconfig
set ifconfiglist [split $ifconf "\n"]
foreach ifconfig $ifconfiglist {
scan $ifconfig "INTERFACE=%s INET=%s MASK=%s MAC=%s " iface inet mask mac
......@@ -46,11 +45,9 @@ proc getmac {ipaddr} {
return ""
}
# assume PATH properly set by wrapper script
if { [catch {set nseconfig [exec tmcc nseconfigs]} errMsg] == 1 } {
puts stderr "NSE: tmcc nseconfigs: $errMsg"
exit 2
}
set tmccnseconfigs [open /etc/testbed/tmcc.nseconfigs r]
set nseconfig [read $tmccnseconfigs]
close $tmccnseconfigs
# If there is no nseconfig associated with this
# node, then we just give up
......@@ -70,6 +67,11 @@ if { [catch {eval $nseconfig} errMsg] == 1 } {
# the name of the simulator instance variable might not
# always be 'ns', coming from the TB parser
set ns [Simulator instance]
# we only need 1 RAW IP socket for introducing packets into the network
set ipnet [new Network/IP]
$ipnet open writeonly
# configuring NSE FullTcp traffic generators
set objnamelist ""
if { $nsetrafgen_present == 1 } {
......@@ -132,72 +134,66 @@ if { $nsetrafgen_present == 1 } {
lappend objnamelist [$telnetobj set objname]
}
}
}
# for each entry in `tmcc trafgens` that has NSE as the generator
# configure that object to connect to a newly created
# TCPTap along with the required Live and RAW IP objects. Set the filter and interface
# after learning it from tmcc commands and other scripts in /etc/testbed
# we only need 1 RAW IP socket for introducing packets into the network
set ipnet [new Network/IP]
$ipnet open writeonly
# configuring NSE FullTcp traffic generators
if { [catch {set tmcctrafgens [exec tmcc trafgens]} errMsg] == 1 } {
puts stderr "NSE: tmcc trafgens: $errMsg"
exit 3
}
set trafgenlist [split $tmcctrafgens "\n"]
set formatstr {TRAFGEN=%s MYNAME=%s MYPORT=%u PEERNAME=%s PEERPORT=%u PROTO=%s ROLE=%s GENERATOR=%s}
variable i 0
foreach trafgen $trafgenlist {
scan $trafgen $formatstr trafgen myname myport peername peerport proto role gen
if { $gen != "NSE" || $proto != "tcp" } {
continue
}
# for each entry in `tmcc trafgens` that has NSE as the generator
# configure that object to connect to a newly created
# TCPTap along with the required Live and RAW IP objects. Set the filter and interface
# after learning it from tmcc commands and other scripts in /etc/testbed
# if the variable in $trafgen exists, we create a bunch of taps
# first do the tap part
if { [info exists $trafgen] == 1 } {
# convert myname and peername to corresponding ipaddresses
# using the getipaddr helper subroutine
set myipaddr [getipaddr $myname]
set peeripaddr [getipaddr $peername]
# find interface name with a helper subroutine
set interface [getmac $myipaddr]
# one TCPTap object per TCP class that we have instantiated
set tcptap($i) [new Agent/TCPTap]
$tcptap($i) nsipaddr $myipaddr
$tcptap($i) nsport $myport
$tcptap($i) extipaddr $peeripaddr
$tcptap($i) extport $peerport
# open the bpf, set the filter for capturing incoming packets towards
# the current tcp object
set bpf_tcp($i) [new Network/Pcap/Live]
set dev_tcp($i) [$bpf_tcp($i) open readonly $interface]
$bpf_tcp($i) filter "tcp and dst $myipaddr and dst port $myport and src $peeripaddr and src port $peerport"
# associate the 2 network objects in the TCPTap object
$tcptap($i) network-incoming $bpf_tcp($i)
$tcptap($i) network-outgoing $ipnet
# attach the TCPTap agent to node n1
$ns attach-agent $n1 $tcptap($i)
# connect this tap and the particular tcp agent
set tcpagent($i) [expr \$$trafgen]
$ns connect $tcpagent($i) $tcptap($i)
incr i
set tmcctrafgens [open /etc/testbed/tmcc.trafgens r]
set tmcctraf [read $tmcctrafgens]
close $tmcctrafgens
set trafgenlist [split $tmcctraf "\n"]
set formatstr {TRAFGEN=%s MYNAME=%s MYPORT=%u PEERNAME=%s PEERPORT=%u PROTO=%s ROLE=%s GENERATOR=%s}
variable i 0
foreach trafgen $trafgenlist {
scan $trafgen $formatstr trafgen myname myport peername peerport proto role gen
if { $gen != "NSE" || $proto != "tcp" } {
continue
}
# if the variable in $trafgen exists, we create a bunch of taps
# first do the tap part
if { [info exists $trafgen] == 1 } {
# convert myname and peername to corresponding ipaddresses
# using the getipaddr helper subroutine
set myipaddr [getipaddr $myname]
set peeripaddr [getipaddr $peername]
# find interface name with a helper subroutine
set interface [getmac $myipaddr]
# one TCPTap object per TCP class that we have instantiated
set tcptap($i) [new Agent/TCPTap]
$tcptap($i) nsipaddr $myipaddr
$tcptap($i) nsport $myport
$tcptap($i) extipaddr $peeripaddr
$tcptap($i) extport $peerport
# open the bpf, set the filter for capturing incoming packets towards
# the current tcp object
set bpf_tcp($i) [new Network/Pcap/Live]
set dev_tcp($i) [$bpf_tcp($i) open readonly $interface]
$bpf_tcp($i) filter "tcp and dst $myipaddr and dst port $myport and src $peeripaddr and src port $peerport"
# associate the 2 network objects in the TCPTap object
$tcptap($i) network-incoming $bpf_tcp($i)
$tcptap($i) network-outgoing $ipnet
# attach the TCPTap agent to node n1_FullTcp
$ns attach-agent $n1_FullTcp $tcptap($i)
# connect this tap and the particular tcp agent
set tcpagent($i) [expr \$$trafgen]
$ns connect $tcpagent($i) $tcptap($i)
incr i
}
}
}
if { $simcode_present == 1 } {
......@@ -240,20 +236,24 @@ if { $simcode_present == 1 } {
}
# get some params to configure the event system interface
#set boss [lindex [split [exec tmcc bossinfo] " "] 0]
#set pideidlist [split [exec hostname] "."]
#set vnode [lindex $pideidlist 0]
#set eid [lindex $pideidlist 1]
#set pid [lindex $pideidlist 2]
#set logpath "/proj/$pid/exp/$eid/logs/nse-$vnode.log"
#if { $objnamelist != {} } {
# Configuring the Scheduler to monitor the event system
# set evsink [new TbEventSink]
# $evsink event-server "elvin://$boss"
# $evsink objnamelist [join $objnamelist ","]
# $evsink logfile $logpath
# [$ns set scheduler_] tbevent-sink $evsink
#}
if { $objnamelist != {} } {
set tmccbossinfo [open /etc/testbed/tmcc.bossinfo r]
set tmccboss [read $tmccbossinfo]
close $tmccbossinfo
set boss [lindex [split $tmccboss " "] 0]
set pideidlist [split [exec hostname] "."]
set vnode [lindex $pideidlist 0]
set eid [lindex $pideidlist 1]
set pid [lindex $pideidlist 2]
set logpath "/proj/$pid/exp/$eid/logs/nse-$vnode.log"
# Configuring the Scheduler to monitor the event system
set evsink [new TbEventSink]
$evsink event-server "elvin://$boss"
$evsink objnamelist [join $objnamelist ","]
$evsink logfile $logpath
[$ns set scheduler_] tbevent-sink $evsink
}
$ns run
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment