- stats = self.gen.get_stats()
-
- # compute total sent and received traffic on both ports
- total_rx = 0
- total_tx = 0
- for port in self.PORTS:
- total_rx += float(stats[port]['rx'].get('total_pkts', 0))
- total_tx += float(stats[port]['tx'].get('total_pkts', 0))
-
- # how much of traffic came back
- ratio = total_rx / total_tx if total_tx else 0
-
- if ratio > threshold:
- self.gen.clear_stats()
- self.gen.clear_streamblock()
- LOG.info('End-to-end connectivity ensured')
- return
-
- time.sleep(self.config.generic_poll_sec)
+ self.gen.fetch_capture_packets()
+ self.gen.stop_capture()
+
+ for packet in self.gen.packet_list:
+ mac_addresses.add(packet['binary'][6:12])
+ if ln != len(mac_addresses):
+ ln = len(mac_addresses)
+ LOG.info('Flows passing traffic %d / %d', ln,
+ self.config.service_chain_count * 2)
+ if len(mac_addresses) == self.config.service_chain_count * 2:
+ LOG.info('End-to-end connectivity ensured')
+ return
+
+ if not self.skip_sleep:
+ time.sleep(self.config.generic_poll_sec)