MCPcopy Create free account
hub / github.com/FDio/vpp / send_and_expect_multi

Method send_and_expect_multi

test/framework.py:587–646  ·  view source on GitHub ↗
(
        self,
        send: list[Send],
        expect: list[Expect],
        trace: bool = True,
        log_packets: bool = True,
        msg: str | None = None,
        stats_diff: StatsDiff | None = None,
        timeout: float | None = None,
        assert_nothing_captured: list[VppPGInterface] | None = None,
    )

Source from the content-addressed store, hash-verified

585 self.compare_stats_with_snapshot(stats_diff, stats_snapshot)
586
587 def send_and_expect_multi(
588 self,
589 send: list[Send],
590 expect: list[Expect],
591 trace: bool = True,
592 log_packets: bool = True,
593 msg: str | None = None,
594 stats_diff: StatsDiff | None = None,
595 timeout: float | None = None,
596 assert_nothing_captured: list[VppPGInterface] | None = None,
597 ) -> list[Capture]:
598 if stats_diff:
599 stats_snapshot = self.snapshot_stats(stats_diff)
600
601 for s in send:
602 s.interface.add_stream(s.packets, worker=s.worker)
603 if log_packets:
604 self.logger.debug(
605 ppc(f"Adding stream '{msg}' to worker {s.worker}:", s.packets)
606 )
607
608 self.pg_enable_capture(self.pg_interfaces)
609 self.pg_start(trace=trace)
610
611 if timeout is not None:
612 deadline = time.time() + timeout
613
614 if expect:
615 capture = [
616 Capture(
617 interface=e.interface,
618 packets=e.interface.get_capture(
619 expected_count=e.expected_count,
620 timeout=None if timeout is None else deadline - time.time(),
621 filter_out_fn=e.filter_out_fn,
622 ),
623 )
624 for e in expect
625 ]
626 else:
627 capture = []
628
629 if assert_nothing_captured is None:
630 assert_nothing_captured = self.pg_interfaces
631 expect_intfs = {e.interface for e in expect} if expect else set()
632 for i in assert_nothing_captured:
633 if i not in expect_intfs:
634 i.assert_nothing_captured(
635 timeout=None if timeout is None else deadline - time.time()
636 )
637
638 if trace:
639 if msg:
640 self.logger.debug(f"send_and_expect: {msg}")
641 self.logger.debug(self.vapi.cli("show trace"))
642
643 if stats_diff:
644 self.compare_stats_with_snapshot(stats_diff, stats_snapshot)

Callers 15

send_and_expectMethod · 0.95
test_reassemblyMethod · 0.80
test_reversedMethod · 0.80
test_randomMethod · 0.80
test_duplicatesMethod · 0.80
test_overlap1Method · 0.80
test_overlap2Method · 0.80
test_timeout_inlineMethod · 0.80
test_disabledMethod · 0.80
test_reassemblyMethod · 0.80
test_reversedMethod · 0.80
test_randomMethod · 0.80

Calls 11

pg_enable_captureMethod · 0.95
pg_startMethod · 0.95
ppcFunction · 0.90
CaptureClass · 0.85
setFunction · 0.50
snapshot_statsMethod · 0.45
add_streamMethod · 0.45
get_captureMethod · 0.45
cliMethod · 0.45

Tested by 15

test_reassemblyMethod · 0.64
test_reversedMethod · 0.64
test_randomMethod · 0.64
test_duplicatesMethod · 0.64
test_overlap1Method · 0.64
test_overlap2Method · 0.64
test_timeout_inlineMethod · 0.64
test_disabledMethod · 0.64
test_reassemblyMethod · 0.64
test_reversedMethod · 0.64
test_randomMethod · 0.64
test_duplicatesMethod · 0.64