[Click] Script element

Cliff Frey cliff at meraki.com
Thu Mar 11 13:35:52 EST 2010


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
>


More information about the click mailing list