此内容没有您所选择的语言版本。
Chapter 6. Debugging
6.1. Locate the logs 复制链接链接已复制到粘贴板!
6.1.1. Access OpenDaylight logs 复制链接链接已复制到粘贴板!
The OpenDaylight logs are stored on OpenDaylight nodes, where you can find them in the /opt/opendaylight/data/log/
directory.
OpenDaylight stores its logs in the karaf.log
file.
-
The latest log is named
karaf.log
, while any older logs are numbered, such askaraf.log.1
, and so on.
6.1.2. Access OpenDaylight logs through karaf shell 复制链接链接已复制到粘贴板!
Another way to access the logs is to login to the karaf shell on the OpenDaylight node and display the log files.
Connect to the karaf account:
ssh -p 8101 karaf@localhost
$ ssh -p 8101 karaf@localhost
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enable trace level logging on NetVirt.
log set TRACE org.opendaylight.netvirt
$ log set TRACE org.opendaylight.netvirt
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you need to tail the logs inside of the karaf shell, use
log:tail
$ log:tail
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
More information
- The karaf shell helps users enable different logging levels for any OpenDaylight feature.
- If you enable TRACE, it is possible that you will receive an extremely big number of log files.
6.1.3. Access OpenStack Networking logs 复制链接链接已复制到粘贴板!
When OpenStack network-related commands fail, the first step is to examine the neutron logs:
These logs are stored in server.log
, located on each neutron node in the /var/log/neutron
directory.
-
The
server.log
file also includes errors about the communication with OpenDaylight. - If the neutron error originates from interacting with OpenDaylight, it is necessary to examine the OpenDaylight logs as well, to locate the cause of the failure.
6.2. Debug networking errors 复制链接链接已复制到粘贴板!
If you experience network error (for example, there is no instance connectivity), but no errors are reported when issuing OpenStack commands or in the neutron logs, then it may be useful to inspect the OVS nodes for network traffic and OpenFlow flows:
- Login (as the superuser) to the affected node where the network error has occurred.
Display the information about the br-int switch.
ovs-ofctl -O openflow13 show br-int
# ovs-ofctl -O openflow13 show br-int
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Examine the output. It will be similar to this example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow List the statistics for the br-int switch.
ovs-ofctl -O openflow13 dump-ports br-int
# ovs-ofctl -O openflow13 dump-ports br-int
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Examine the output. It will be similar to this example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
More information
- In step 3, you can see that there are three ports created on this OVS node. The first is a patch port going to the bridge br-ex, which in this scenario is used for External network connectivity. The second port is a tap port which connects to a DHCP agent instance (we know this because the host is a controller, otherwise on a Compute role it would be an instance), while the third port is a VXLAN tunnel port created for the tenant traffic. When you know what each port is, you can examine the port statistics to verify that the port is indeed receiving/sending traffic (see Step 4).
-
From the output in Step 5, you can see that each port is receiving (
rx pkts
) and sending packets (tx pkts
).
6.2.1. Advanced debugging using OpenFlow flows 复制链接链接已复制到粘贴板!
For advanced users who are familiar with OpenFlow, the next level of debugging is to examine the flows on the switch in order to detect where traffic is being dropped.
You can list the flows, as well as how many packets have hit them, by entering the following command:
ovs-ofctl -O openflow13 dump-flows br-int
# ovs-ofctl -O openflow13 dump-flows br-int
The output of the command will provide you with the necessary information.
The sample output has been edited for length.
6.2.2. Packet traverse in OpenFlow 复制链接链接已复制到粘贴板!
The important things to understand are that the network functions performed on a packet are broken into different OpenFlow tables, and packets traverse those tables in order, starting from zero. An incoming packet lands in table 0, and then progresses via the OpenFlow Pipeline until it is sent out of a port, to the OpenDaylight Controller, or dropped. A packet may skip one or more tables depending on which network function it may need to go to. The full diagram of tables and how they correspond to network functions is shown below:
Figure 6.1. OpenDaylight NetVirt OpenFlow Pipeline