floodlight/oftest — pull request #42 by rlane (2013-03-08 01:12:39+00:00)
Title: Fuzzy bytecounter assertions

Reviewer: @dtalayco

Some switches include the 4-byte Ethernet CRC in their counters. Since the spec is ambiguous here we allow this and similar behaviour by allowing the byte counters to increment up to 10% more than we'd usually expect.

Most of these changes move stats utility functions to testutils. The major change to the functions is adding an 'initial' parameter which is used to diff the counters before and after they're incremented. This was previously done directly in the test code. We have to move it to the testutils code because the value that we should take 110% of is the difference between the old and new values, not the new value itself. A port could have many gigabytes of traffic already counted when OFTest is run, so if we allowed an extra 10% of that the assertion would be too permissive.