[Click] Script element

Jimmy fanyang.scu at gmail.com
Fri Mar 12 14:43:22 EST 2010


Thank you all for this kind explanation, which clearifies my confusion.

I'm just starting with click and I think it is really fun!

J.

On Thu, Mar 11, 2010 at 1:40 PM, Ian Rose <ianrose at eecs.harvard.edu> wrote:
> Jimmy -
>
> I'm not sure if you care, but if you want your Script element to run at
> other times (e.g. when a packet is received, or when a handler is called),
> take a look at the optional TYPE parameter:
>
> http://read.cs.ucla.edu/click/elements/script#script-types
>
> For what its worth, Script(TYPE PACKET, ...) is a nice debugging tool.
>
> - Ian
>
> Cliff Frey wrote:
>>
>> First the click configuration is loaded.  This means that all elements are
>> created (including all Script elements) and configured and initialized.
>>  At
>> this point, the click configuration is considered to be loaded.  Then
>> "tasks" are allowed to run.  In your example, the Source element, UnQueue
>> element, and Script element all have associated tasks.  Those tasks will
>> start running in round-robin fashion.  You cannot really make any
>> assumptions about the order of the first instruction in your script vs the
>> first action of the Source element, but you can control it if the Source
>> starts out disabled.
>>
>> For instance
>>
>> click foo.click
>>
>> foo.click:
>>
>> is :: InfiniteSource(LIMIT 1, ACTIVE false) -> Print -> Discard;
>> Script(
>>  print "script is starting",
>>  writeq is.active true,
>>  print "script started the source",
>>  wait 1.0,
>>  print "script is stopping the router",
>>  stop);'
>>
>>
>> On Thu, Mar 11, 2010 at 10:10 AM, Jimmy <fanyang.scu at gmail.com> wrote:
>>
>>> Hi all,
>>>
>>> I read the script element description and know that it can be used to
>>> configure the network. I also used it to implement some simple
>>> comfiguration.
>>>
>>> My question is how and when is this element executed?  Below is a
>>> simple example:
>>>
>>> 1  Source -> Queue -> UnQueue -> Print -> Discard;
>>> 2  Script( ... );
>>>
>>> So line 1 just sets the network and line 2 implements the
>>> configuration. Is line 2 executed parallel with line 1? Or is it
>>> executed after line 1 is executed?
>>>
>>> Thanks.
>>> --
>>> Best Regards,
>>>
>>> Jimmy
>>> _______________________________________________
>>> click mailing list
>>> click at amsterdam.lcs.mit.edu
>>> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>>>
>> _______________________________________________
>> click mailing list
>> click at amsterdam.lcs.mit.edu
>> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>



-- 
Best Regards,

Jimmy



More information about the click mailing list