Error diagnosis statement needs some improvement
When a test fails, particularly an output matching expectation, the diagnosis statement can be a bit convoluted and difficult to parse --- it should be improved. Here's an example of a packet output expectation failure, with a couple predicates and inexact matching. It should be easier for someone to read this and immediately pick out the main points.
You called send_packet and while the output port router-eth0 is ok, a inexact match of packet contents passed, but when comparing the packet you sent versus what I expected, the predicate (lambda pkt: pkt[-2].msgtype==4 and len(pkt[-1])==2) passed, the predicate (lambda pkt: set([a.network for a in pkt[-1]])=={IPv4Network("10.0.0.0/30"), IPv4Network("10.0.13.0/24")}) passed, and the predicate (lambda pkt: set([a.routerid for a in pkt[-1]])=={0,2}) failed. Packet field comparisons matched correctly: Ethernet 10:00:00:00:00:01->e0:00:00:00:00:00 IP | IPv4 10.0.0.1->10.0.0.2 OSPF | LSHeader LinkStateUpdate routerid: 13 areaid: 0 | LSUpdate seq 3 ttl 10: <router 0, 10.0.0.0/30>, <router 0, 10.0.13.0/24>..