+ def create_stream_crosswise_vrf(self, src_if, vrf_id, packet_sizes):
+ """
+ Create input packet stream for negative test for leaking across
+ different VRFs for defined interface using hosts list.
+
+ :param object src_if: Interface to create packet stream for.
+ :param int vrf_id: The FIB table / VRF ID where src_if is assigned.
+ :param list packet_sizes: List of required packet sizes.
+ :return: Stream of packets.
+ """
+ pkts = []
+ src_hosts = src_if.remote_hosts
+ vrf_lst = list(self.vrf_list)
+ vrf_lst.remove(vrf_id)
+ for vrf in vrf_lst:
+ for dst_if in self.pg_if_by_vrf_id[vrf]:
+ for dst_host in dst_if.remote_hosts:
+ src_host = random.choice(src_hosts)
+ pkt_info = self.create_packet_info(src_if, dst_if)
+ payload = self.info_to_payload(pkt_info)
+ p = (Ether(dst=src_if.local_mac, src=src_host.mac) /
+ IP(src=src_host.ip4, dst=dst_host.ip4) /
+ UDP(sport=1234, dport=1234) /
+ Raw(payload))
+ pkt_info.data = p.copy()
+ size = random.choice(packet_sizes)
+ self.extend_packet(p, size)
+ pkts.append(p)
+ self.logger.debug("Input stream created for port %s. Length: %u pkt(s)"
+ % (src_if.name, len(pkts)))
+ return pkts
+