[PATCH v3 1/1] dts: rework packet addressing
Juraj Linkeš
juraj.linkes at pantheon.tech
Thu Sep 26 14:30:59 CEST 2024
> diff --git a/dts/framework/test_suite.py b/dts/framework/test_suite.py
> + def _adjust_addresses(self, packets: list[Packet], expected: bool = False) -> list[Packet]:
> + # The packet is routed from TG egress to TG ingress regardless of whether it is
> + # expected or not.
> + if ip_src_is_unset:
> + l3_to_use.src = self._tg_ip_address_egress.ip.exploded
> +
> + if ip_dst_is_unset:
> + l3_to_use.dst = self._tg_ip_address_ingress.ip.exploded
So this is where l3_to_use also appears. This could also be in the same
if branch, right? As you mentioned, ip_src_is_unset is only going to be
true in that branch.
Now that I look at it, we're mixing the update of l2 addresses (starting
with pkt_src_is_unset = "src" not in packet.fields) with l3 addresses
(starting with num_ip_layers right below that). We could first do l2
addresses, then l3 addresses. And I don't think we even need the
*_is_unset variables, they're only used once.
> + ret_packets.append(Ether(packet.build()))
>
> - return Ether(packet.build())
> + return ret_packets
>
> def verify(self, condition: bool, failure_description: str) -> None:
> """Verify `condition` and handle failures.
More information about the dev
mailing list