+ raise RuntimeError("Matching packet unsuccessful: {0}".
+ format(ether.__repr__()))
+
+ if encaps_rx == 'Dot1q':
+ if ether[Dot1Q].vlan == int(vlan_rx):
+ logger.trace("VLAN matched")
+ else:
+ raise RuntimeError('Ethernet frame with wrong VLAN tag ({}-'
+ 'received, {}-expected):\n{}'.
+ format(ether[Dot1Q].vlan, vlan_rx,
+ ether.__repr__()))
+ ip = ether[Dot1Q].payload
+ elif encaps_rx == 'Dot1ad':
+ raise NotImplementedError()
+ else:
+ ip = ether.payload
+
+ if not isinstance(ip, ip_format):
+ raise RuntimeError("Not an IP packet received {0}".
+ format(ip.__repr__()))
+
+ # Compare data from packets
+ if src_ip == ip.src:
+ logger.trace("Src IP matched")
+ else:
+ raise RuntimeError("Matching Src IP unsuccessful: {} != {}".
+ format(src_ip, ip.src))
+
+ if dst_ip == ip.dst:
+ logger.trace("Dst IP matched")
+ else:
+ raise RuntimeError("Matching Dst IP unsuccessful: {} != {}".
+ format(dst_ip, ip.dst))
+