MCPcopy Create free account
hub / github.com/F-Stack/f-stack / _adjust_addresses

Method _adjust_addresses

dpdk/dts/framework/test_suite.py:167–194  ·  view source on GitHub ↗

Assumptions: Two links between SUT and TG, one link is TG -> SUT, the other SUT -> TG.

(self, packet: Packet, expected: bool = False)

Source from the content-addressed store, hash-verified

165 return self._adjust_addresses(packet, expected=True)
166
167 def _adjust_addresses(self, packet: Packet, expected: bool = False) -> Packet:
168 """
169 Assumptions:
170 Two links between SUT and TG, one link is TG -> SUT,
171 the other SUT -> TG.
172 """
173 if expected:
174 # The packet enters the TG from SUT
175 # update l2 addresses
176 packet.src = self._sut_port_egress.mac_address
177 packet.dst = self._tg_port_ingress.mac_address
178
179 # The packet is routed from TG egress to TG ingress
180 # update l3 addresses
181 packet.payload.src = self._tg_ip_address_egress.ip.exploded
182 packet.payload.dst = self._tg_ip_address_ingress.ip.exploded
183 else:
184 # The packet leaves TG towards SUT
185 # update l2 addresses
186 packet.src = self._tg_port_egress.mac_address
187 packet.dst = self._sut_port_ingress.mac_address
188
189 # The packet is routed from TG egress to TG ingress
190 # update l3 addresses
191 packet.payload.src = self._tg_ip_address_egress.ip.exploded
192 packet.payload.dst = self._tg_ip_address_ingress.ip.exploded
193
194 return Ether(packet.build())
195
196 def verify(self, condition: bool, failure_description: str) -> None:
197 if not condition:

Callers 2

get_expected_packetMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected