neutron/neutron/tests/common/agents
Sławek Kapłoński 386ec26b3d [Fullstack] Change how DSCP marking packets are tested
In fullstack test test_dscp_marking_packets two fake hosts are
created, each of them has got one fake instance (called sender and
receiver).
Instance called "sender" sends ICMP packets to instance called
"receiver". In receiver's namespace tcpdump process is spawned with
filter to match only packets marked with specified DSCP value.
After sender instance successfully pings receiver, tcpdump process
is killed and stdout from it was examined to search logged ICMP
packets which were send from sender's IP to receiver's IP address.
That check was failing sometimes as is described in bug report.

It was failing when tcpdump doesn't capture any packets so there was
nothing on stdout from it. But even in such case tcpdump reports on
stderr summary of packets and it was like below:

0 packets captured
6 packets received by filter
0 packets dropped by kernel

which means that packets matching our filter was received by tcpdump but
were probably not processed yet. See [1] for more details.

So this patch changes filter used in tcpdump and way how its output is
checked.
Now in filter expression there are added src and dst IP addresses also so
it will match only packets send from sender instance to receiver instance.
After that tcpdump's stderr output is examined with regex to check if
line like:

X packets received by filter

is there and if X value is different than 0. If so, it means that
tcpdump received packets with wanted DSCP mark and test should pass.

[1] https://unix.stackexchange.com/a/29369

Change-Id: Ia3522237dc787edb90d162ac4a5535ff5d2a03d5
Closes-Bug: #1733649
2018-01-08 09:13:02 +00:00
..
__init__.py Append @randtoken to L3 agent namespaces in full stack tests 2015-05-12 20:32:54 +00:00
l2_extensions.py [Fullstack] Change how DSCP marking packets are tested 2018-01-08 09:13:02 +00:00
l3_agent.py Remove translation of help messages from tests 2017-09-25 09:49:38 +00:00
ovs_agent.py Revert "Fix file permissions" 2016-11-23 12:59:36 +00:00