[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ns] How to attach agent to node in tcl code?





On Wed, 7 Feb 2001, Tulius Lima wrote:

> Hi,
> 
> 
>         I need to create an Agent class (Agent/Ping) inside a node. I am
> using the following code but it is returning a error.
> 
> ----------
>     MplsNode instproc init args {
>          (...cut...)
>         # TE related
>             # creating ping agent
>             $self instvar ping_
>             set ping_ [new Agent/TEPing]
> 
>             # creating simulator instance
>             set ns [Simulator instance]
> 
>             # attaching ping agent to this node
>             $ns attach-agent $self $ping_
> 
>          (...cut...)
>     }
> ----------
> 
>         The error returned is the following:
> 
> ---------------------------
> wrong # args: should be "set varName ?newValue?"
>     while compiling
> "set ping_ [new Agent/TEPing]          #"
>     (compiling body of proc "_o16", line 5)
>     (MplsNode init line 5)
>     invoked from within
> "_o16 init {}"
>     (Class create line 1)
>     invoked from within
> "MplsNode create _o16 {}"
>     invoked from within
> "catch "$className create $o $args" msg"
>     (procedure "new" line 3)
>     invoked from within
> "new [Simulator set node_factory_] $args"
>     (procedure "_o3" line 27)
>     (Simulator node line 27)
>     invoked from within
> "$self node"
>     (procedure "_o3" line 9)
>     (Simulator MPLSnode line 9)
>     invoked from within
> "$ns MPLSnode"
>     (file "/.../ping-test07.tcl" line 29)
> ---------------------------
> 
>         I am using ns v2.1b6.
> 

invoked from "$ns MPLSnode"? Man, that's a scary one! :) I think
the problem might come from ping-test07.tcl rather than the code above...   


> 
>         Thanks!
>         Tulius
>