[ns] Problem with hierarchical addressing with TCP
Vivek Yadav
vivek@logiceastern.com
Thu, 4 Jan 2001 11:07:30 +0530
This is a multi-part message in MIME format.
------=_NextPart_000_0040_01C0763E.87CA35C0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I am new to NS and i am trying to build a simple topology with =
hierarchical addressing with TCP Traffic when i run the script It gives =
me an illegal operation error on 98=20
but when i work the same script with flat addressing the script runs =
perfectly
can anyone help me out with this problem=20
I am attaching the script so if there is any problem with it please tell =
me
set ns [new Simulator]
$ns rtproto Session
$ns set-address-format hierarchical=20
set f [open out.tr w]
$ns trace-all $f
set nf [open out.nam w]
$ns namtrace-all $nf
AddrParams set domain_num_ 1
lappend cluster_num 1=20
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel 4
AddrParams set nodes_num_ $eilastlevel
set num_node 4
proc finish {} {
global ns nf
global ns f=20
$ns flush-trace
close $nf
close $f=20
exit 0
}
set temp {0.0.0 0.0.2 0.0.11 0.0.6}
for {set i 0} {$i < $num_node } {incr i} {
set n($i) [$ns node [lindex $temp $i]]
puts " [$n($i) node-addr]"
puts " [$n($i) id]"
}
for {set i 0} {$i < $num_node} {incr i} {
$ns duplex-link $n($i) $n([expr ($i+1)%$num_node]) 1Mb 10ms DropTail
}
$ns duplex-link $n(0) $n(2) 1Mb 10ms DropTail
$ns duplex-link-op $n(0) $n(1) queuePos 0.5
$ns cost $n(0) $n(1) 2
$ns cost $n(0) $n(3) 5
$ns cost $n(0) $n(2) 4
$ns cost $n(1) $n(2) 1
$ns cost $n(2) $n(3) 1
$ns cost $n(1) $n(0) 2
$ns cost $n(3) $n(0) 5
$ns cost $n(2) $n(0) 4
$ns cost $n(2) $n(1) 1
$ns cost $n(3) $n(2) 2
set tcp [new Agent/TCP]
$ns attach-agent $n(0) $tcp
set ftp [new Application/FTP] ;
$ftp attach-agent $tcp
set sink [new Agent/TCPSink]
$ns attach-agent $n(3) $sink
$ns at 0.5 "$ftp start"
$ns connect $tcp $sink
$ns rtmodel-at 1.0 down $n(1) $n(2)=20
$ns rtmodel-at 2.0 up $n(1) $n(2)=20
$ns at 5.0 "finish"
$ns run
------=_NextPart_000_0040_01C0763E.87CA35C0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2014.210" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>I am new to NS and i am trying to build =
a simple=20
topology with hierarchical addressing with TCP Traffic when i run the =
script It=20
gives me an illegal operation error on 98 </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>but when i work the same script with =
flat=20
addressing the script runs perfectly</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>can anyone help me out with this =
problem=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I am attaching the script so if there =
is any=20
problem with it please tell me</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT size=3D2>
<P>set ns [new Simulator]</P>
<P>$ns rtproto Session</P>
<P>$ns set-address-format hierarchical </P>
<P> </P>
<P>set f [open out.tr w]</P>
<P>$ns trace-all $f</P>
<P>set nf [open out.nam w]</P>
<P>$ns namtrace-all $nf</P>
<P> </P>
<P>AddrParams set domain_num_ 1</P>
<P>lappend cluster_num 1 </P>
<P>AddrParams set cluster_num_ $cluster_num</P>
<P>lappend eilastlevel 4</P>
<P>AddrParams set nodes_num_ $eilastlevel</P>
<P> </P>
<P>set num_node 4</P>
<P> </P>
<P>proc finish {} {</P>
<P>global ns nf</P>
<P>global ns f </P>
<P>$ns flush-trace</P>
<P>close $nf</P>
<P>close $f </P>
<P>exit 0</P>
<P>}</P>
<P>set temp {0.0.0 0.0.2 0.0.11 0.0.6}</P>
<P> </P>
<P>for {set i 0} {$i < $num_node } {incr i} {</P>
<P>set n($i) [$ns node [lindex $temp $i]]</P>
<P>puts " [$n($i) node-addr]"</P>
<P>puts " [$n($i) id]"</P>
<P>}</P>
<P> </P>
<P>for {set i 0} {$i < $num_node} {incr i} {</P>
<P>$ns duplex-link $n($i) $n([expr ($i+1)%$num_node]) 1Mb 10ms =
DropTail</P>
<P>}</P>
<P>$ns duplex-link $n(0) $n(2) 1Mb 10ms DropTail</P>
<P>$ns duplex-link-op $n(0) $n(1) queuePos 0.5</P>
<P> </P>
<P> </P>
<P>$ns cost $n(0) $n(1) 2</P>
<P>$ns cost $n(0) $n(3) 5</P>
<P>$ns cost $n(0) $n(2) 4</P>
<P>$ns cost $n(1) $n(2) 1</P>
<P>$ns cost $n(2) $n(3) 1</P>
<P>$ns cost $n(1) $n(0) 2</P>
<P>$ns cost $n(3) $n(0) 5</P>
<P>$ns cost $n(2) $n(0) 4</P>
<P>$ns cost $n(2) $n(1) 1</P>
<P>$ns cost $n(3) $n(2) 2</P>
<P> </P>
<P>set tcp [new Agent/TCP]</P>
<P>$ns attach-agent $n(0) $tcp</P>
<P>set ftp [new Application/FTP] ;</P>
<P>$ftp attach-agent $tcp</P>
<P>set sink [new Agent/TCPSink]</P>
<P>$ns attach-agent $n(3) $sink</P>
<P>$ns at 0.5 "$ftp start"</P>
<P>$ns connect $tcp $sink</P>
<P>$ns rtmodel-at 1.0 down $n(1) $n(2) </P>
<P>$ns rtmodel-at 2.0 up $n(1) $n(2) </P>
<P>$ns at 5.0 "finish"</P>
<P> </P>
<P>$ns run</P></FONT></DIV></FONT></DIV></BODY></HTML>
------=_NextPart_000_0040_01C0763E.87CA35C0--