[ndnSIM] Problem with modify ndn-simple to replay

Ygor Amaral ygor.amaral at gmail.com
Sat Apr 24 15:03:12 PDT 2021


Hi Parisa,

My previous responses have already shown my opinion on what you should do
to achieve your goal.

One of his last questions was: *How can I schedule?*

I told you to look at the ScheduleNextPacket member function at the
ndn-consumer-cbr file.

line 84: if (m_firstTime) {
line 85:      m_sendEvent = Simulator::Schedule(Seconds(0.0),
&Consumer::SendPacket, this);

The first time the ScheduleNextPacket is executed, the interest packet is
sent immediately (0 delay), in other executions the delay is Seconds (1.0 /
m_frequency) or Seconds (m_random-> GetValue ()).

Probably in the ns-3 documentation, it will explain that
Simulator::Schedule(*delay*, *function name to be invoked*, *arguments to
be passed to the informed function*);

Use this information to create your own algorithm.

I also explained to you about your other questions... replay.txt is just a
fake name for your log file.

I already said that I suggest reading the file inside your custom
application. Where? Wherever you want. It could be in the constructor, for
example.

Imagine that an ndn/ns-3 application is similar to a real application.

I can not go any further than that. Sorry.

Regards,
Ygor Amaral

On Sat, Apr 24, 2021 at 5:03 PM parisa shojaei <parisa.shojaei85 at gmail.com>
wrote:

> Dear Ygor Amaral,
>
> I finished implementing my topology, which has seven consumers and one
> producer using the simple scenario. Now, I want to read from a log file and
> replay to the requests in simple ndnSIm. Would you please let me know where
> I should put the log file? How can I read and replay to the request?
>
>
> The log file format will be like the following:
>
> <Time (epoch)>, <name>
> 12345, /google/index
> 12346, /cnn/index
> 13456, /tntech/index
>
>
>
> Yours Sincerely,
>
> Parisa
>
> On Fri, Apr 23, 2021, 23:16 Ygor Amaral <ygor.amaral at gmail.com> wrote:
>
>> Hi Parisa,
>>
>> Maybe I got it wrong. I thought you wanted to generate requests based on
>> a log file. Where the log file would indicate at which time in the
>> simulation each interest packet would be sent. My tips were about that.
>>
>> Perhaps two days will be insufficient. There is a learning curve for
>> working with ns-3/ndnSIM.
>>
>> Reading the documentation is always the easiest way.
>>
>> Regards,
>> Ygor Amaral
>>
>> On Fri, Apr 23, 2021 at 2:17 PM parisa shojaei <
>> parisa.shojaei85 at gmail.com> wrote:
>>
>>> Hi Ygor,
>>> Thank you for the clarification.
>>> Since I have no experience in this field, and I have just two days to
>>> accomplish my task, I need help.
>>> I created a topology with seven consumers and one producer using
>>> ndn-simple scenario. Now, I don't know where I should put the log file?
>>> Moreover, you mentioned the replay.txt. What should I put inside the
>>> replay.txt? Should I put inside the reply txt my log file?
>>> How can I schedule? Would you please give me tips and recommendations?
>>> Have you any example samples that I study in order to understand the
>>> process.
>>>
>>> Thank you very much for your time and consideration.
>>>
>>> Yours sincerely,
>>> Parisa Shojaei
>>>
>>> On Fri, Apr 23, 2021 at 9:14 AM Ygor Amaral <ygor.amaral at gmail.com>
>>> wrote:
>>>
>>>> Hi Parisa,
>>>>
>>>> One approach that may be ok for you is to add a custom attribute in
>>>> your NDN application (AddAttribute, see ndn-consumer-cbr.cpp).
>>>>
>>>> This attribute can be the path to your log file. Then, when
>>>> instantiating your application, the full path of the log file will be
>>>> informed to your application. For
>>>> example: consumerHelper.SetAttribute("log_file",
>>>> StringValue("/home/parisa/replays/replay1.txt"));
>>>>
>>>> In your application, when it starts up, you will read the file as usual
>>>> in C++ (e.g.: std::ifstream).
>>>>
>>>> That is, my suggestion is that the reading of the log file occurs
>>>> within the application.
>>>>
>>>> After that, you will be able to make all the schedules, according to
>>>> your log file.
>>>>
>>>> Regards,
>>>> Ygor Amaral
>>>>
>>>> On Fri, Apr 23, 2021 at 12:49 AM parisa shojaei <
>>>> parisa.shojaei85 at gmail.com> wrote:
>>>>
>>>>> Dear Ygor,
>>>>> Would you please explain more. I don't understand completely. How I
>>>>> replay the log file? Where I put the log file to read?
>>>>>
>>>>> Best regards,
>>>>> Parisa
>>>>>
>>>>> On Fri, Apr 23, 2021, 00:33 Ygor Amaral <ygor.amaral at gmail.com> wrote:
>>>>>
>>>>>> Hi Parisa,
>>>>>>
>>>>>> You can do that.
>>>>>>
>>>>>> You must create your own consumer application. Use an existing
>>>>>> application as a starting point. For example:
>>>>>>      - ndnSIM/ns-3/src/ndnSIM/apps/ndn-consumer-cbr.cpp (hpp)
>>>>>>      - ndnSIM/ns-3/src/ndnSIM/apps/ndn-consumer-batches.cpp (hpp)
>>>>>>
>>>>>> These applications inherit from:
>>>>>>      - ndnSIM/ns-3/src/ndnSIM/apps/ndn-consumer.cpp (hpp)
>>>>>>
>>>>>> Note that there is the ScheduleNextPacket member function. It is very
>>>>>> important to schedule the next interest packet transmissions. You can
>>>>>> schedule to the times you want.
>>>>>>
>>>>>> It is not a complete answer, but it may help you.
>>>>>>
>>>>>> Regards,
>>>>>> Ygor Amaral
>>>>>>
>>>>>>
>>>>>> On Thu, Apr 22, 2021 at 4:33 PM parisa shojaei via ndnSIM <
>>>>>> ndnsim at lists.cs.ucla.edu> wrote:
>>>>>>
>>>>>>> Dear All,
>>>>>>> If I want to  modify ndn-simple to replay the logs file, how I can
>>>>>>> do this?
>>>>>>> read from a log file and replay the requests?
>>>>>>> The log file format will be like the following:
>>>>>>>
>>>>>>> <Time (epoch)>, <name>
>>>>>>> 12345, /google/index
>>>>>>> 12346, /cnn/index
>>>>>>> 13456, /tntech/index
>>>>>>>
>>>>>>> Yours Sincerely,
>>>>>>> Parisa
>>>>>>> _______________________________________________
>>>>>>> ndnSIM mailing list
>>>>>>> ndnSIM at lists.cs.ucla.edu
>>>>>>> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim
>>>>>>>
>>>>>>
>>>
>>> --
>>>
>>> *Sincerely Yours,*
>>>
>>> *ParisaSadat Shojaei,*
>>>
>>> *M.Sc. in Computer Engineering, Islamic Azad University*
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20210424/75d47d77/attachment-0001.html>


More information about the ndnSIM mailing list