Schedule/Execute command on condition

40 views
Skip to first unread message

Reen Code

unread,
Oct 3, 2014, 4:07:06 PM10/3/14
to ns-3-...@googlegroups.com
I am quite new to NS3 DCE. I am writing a CCNX Network-Simulation and by now I am scheduling a command ie. ccnseqwriter like this:

dce.ResetArguments();
dce.ResetEnvironment();
dce.AddEnvironment("HOME", "/root");
dce.SetBinary("ccnseqwriter");
dce.AddFile("/tmp/file", "/tmp/file");
dce.SetStdinFile("/tmp/file");
dce.AddArgument("ccnx:/testfile");
dce.AddArgument("-r");

putter = dce.Install(nodes.Get(node));
putter.Start(Seconds(time));

This command would write data to the repository. In my implementation the repository can be busy and is indicating that with an extra file in the repository folder (/REPO/).

Can I at runtime of the simulation check for that file and conditioned on its existence and content decide whether to schedule/execute the ccnseqwriter command or just wait?

This question is also asked here, if you want to earn some points:

Thanks in advance

Reencode

Hajime Tazaki

unread,
Nov 6, 2014, 9:35:40 AM11/6/14
to ns-3-...@googlegroups.com

At Fri, 3 Oct 2014 13:07:06 -0700 (PDT),
Reen Code wrote:
>
> [1 <text/plain; UTF-8 (7bit)>]
> I am quite new to NS3 DCE. I am writing a CCNX Network-Simulation and by
> now I am scheduling a command ie. ccnseqwriter like this:
>
> dce.ResetArguments();
> dce.ResetEnvironment();
> dce.AddEnvironment("HOME", "/root");
> dce.SetBinary("ccnseqwriter");
> dce.AddFile("/tmp/file", "/tmp/file");
> dce.SetStdinFile("/tmp/file");
> dce.AddArgument("ccnx:/testfile");
> dce.AddArgument("-r");
>
> putter = dce.Install(nodes.Get(node));
> putter.Start(Seconds(time));
>
> This command would write data to the repository. In my implementation the
> repository can be busy and is indicating that with an extra file in the
> repository folder (/REPO/).
>
> Can I at runtime of the simulation check for that file and conditioned on
> its existence and content decide whether to schedule/execute the
> ccnseqwriter command or just wait?

I don't know this would help you, but it's doable I think
though it's a bit tricky..

if (stat ("files-0/tmp/file",&st) != 0))
{
...
dce.SetBinary("ccnseqwriter");
...
}

or you can just delete unwanted files before an execution.

system ("rm -f files-0/tmp/file");

-- Hajime

> This question is also asked here, if you want to earn some points:
> http://stackoverflow.com/questions/26176662/ns3-dce-ccnx-schedule-execute-command-on-condition
>
> Thanks in advance
>
> Reencode
>
> --
> You received this message because you are subscribed to the Google Groups "ns-3-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
> To post to this group, send email to ns-3-...@googlegroups.com.
> Visit this group at http://groups.google.com/group/ns-3-users.
> For more options, visit https://groups.google.com/d/optout.
> [2 <text/html; UTF-8 (quoted-printable)>]
>
Reply all
Reply to author
Forward
0 new messages