| 710 | return rx |
| 711 | |
| 712 | def send_and_expect_only( |
| 713 | self, intf, pkts, output, timeout=None, stats_diff=None, worker=None, trace=True |
| 714 | ): |
| 715 | if stats_diff: |
| 716 | stats_snapshot = self.snapshot_stats(stats_diff) |
| 717 | |
| 718 | self.pg_send(intf, pkts, worker=worker) |
| 719 | rx = output.get_capture(len(pkts)) |
| 720 | outputs = [output] |
| 721 | |
| 722 | if timeout is not None: |
| 723 | deadline = time.time() + timeout |
| 724 | |
| 725 | for i in self.pg_interfaces: |
| 726 | if i not in outputs: |
| 727 | i.assert_nothing_captured( |
| 728 | timeout=None if timeout is None else deadline - time.time() |
| 729 | ) |
| 730 | |
| 731 | if trace: |
| 732 | self.logger.debug(self.vapi.cli("show trace")) |
| 733 | |
| 734 | if stats_diff: |
| 735 | self.compare_stats_with_snapshot(stats_diff, stats_snapshot) |
| 736 | |
| 737 | return rx |
| 738 | |
| 739 | |
| 740 | if __name__ == "__main__": |