p4lang / p4factory

Compile P4 and run the P4 behavioral simulator
Apache License 2.0
174 stars 106 forks source link

Dump data in logfile #158

Closed holidayfun closed 8 years ago

holidayfun commented 8 years ago

Is there a way to dump data/the whole packet into the logfile or elsewhere?

The pcap dumps that are generated by mininet seem to not include all the packets going in on the device.

If there is a better place to ask questions like this, please just tell me, thanks!

antoninbas commented 8 years ago

I just checked and running bmv2 with --pcap dumps both incoming and outgoing packets. You may want to tell us which commands you ran so we can provide some guidance.

holidayfun commented 8 years ago

I didn't switch to bmv2 until now, after some work it's running with bmv2 and i get the pcap files i expected.

But i got problems with the logging. In the p4s.s1.log there only appear messages for added ports, nothing else. Tried to use the nanomsg_client for bm-0-log.ipc, bmv2-0-notifications.ipc and bmv2-0-debug.ipc but the only output i get is Optaining JSON from switch... Done

The command being made by the python script is /home/hartmann/behavioral-model/targets/bfrv2/bm -i 1@s1-eth1 -i 2@s1-eth2 -i 3@s1-eth3 -i 4@s1-eth4 --pcap --thrift-port 10000 --nanolog ipc:///tmp/bm-0-log.ipc --device-id 0 /home/hartmann/behavioral-model/targets/bfrv2/bfr.json --debugger >/tmp/p4s.s1.log 2>&1 </dev/null &

Any idea what i'm doing wrong?

Thanks for your help!

antoninbas commented 8 years ago

Hi, I don't think you should use --nanolog at all here, it would only provide you with a minimum amount of logging. nanolog was mostly meant to be used as a way to communicate events to other processes. You should probably use --log-console, if you are going to redirect stdout to a file. Alternatively, you can remove the stdout redirection and use --log-file <file path> along with --log-flush. You can get more information about these by starting the switch with -h.

holidayfun commented 8 years ago

Thank you very mutch for this tip!

The --log-file along with --log-flush was what if was looking for.