Debugging with p4app
  
    Log Directory Location
  - Within the Docker container, p4app saves log files to /tmp/p4app-logs.
- By default, /tmp/p4app-logsis mounted from/tmp/p4app-logson the host
machine.
- The log directory location can be overridden by specifying the
P4APP_LOGDIRenv variable.
      - e.g., mkdir ~/mylogs, thenP4APP_LOGDIR=~/mylogs ~/p4app/p4app run .
 
The BMv2 Log
  - Each switch logs to /tmp/p4app-logs/p4s.XXX.log, whereXXXis the name
of the switch.
      - e.g., the log for switch s1will be in/tmp/p4app-logs/p4s.s1.log.
 
PCAP Files
  - By default, BMv2 dumps all packets received/sent by the switches to PCAP
files in the log directory (/tmp/p4app-logs).
- For each switch, there are two PCAP files per port: packets sent by the
switch (*_in.pcap), and received (*_out.pcap).
      - e.g., /tmp/p4app-logs/s1-eth2_out.pcapcontains the packets sent bys1on port2.
 
- Tip: use mergecapfor viewing both PCAPs together:mergecap -w tmp.pcap /tmp/p4app-logs/s1-eth2_* && wireshark tmp.pcap
Mininet Console
  - You can launch a Mininet console from the p4app entry point (main.py).
- The console can be used for inspecting Mininet, for example:
    
      - Show the interfaces for switch s1:mininet> py s1.intfs
- Show help: mininet> help
 
- This can also be used to run commands on hosts:
    
      - Print interface status: mininet> h1 ifconfig
- Send a ping packet from h1:mininet> h1 ping -c1 10.0.0.1
 
Running Commands Inside p4app
  - Once you have launched a p4app, you can interact with it from another terminal
- The p4app execcommand lets you run a program within the container of the most recently launched p4app.
      - Open a shell in the container: ~/src/p4app/p4app exec bash
- Open a shell on a Mininet host within container: ~/src/p4app/p4app exec m h1 bash