Create packet info object containing the source and destination indexes and add it to the testcase's packet info list :param VppInterface src_if: source interface :param VppInterface dst_if: destination interface :returns: _PacketInfo object
(cls, src_if, dst_if)
| 319 | |
| 320 | @classmethod |
| 321 | def create_packet_info(cls, src_if, dst_if): |
| 322 | """ |
| 323 | Create packet info object containing the source and destination indexes |
| 324 | and add it to the testcase's packet info list |
| 325 | |
| 326 | :param VppInterface src_if: source interface |
| 327 | :param VppInterface dst_if: destination interface |
| 328 | |
| 329 | :returns: _PacketInfo object |
| 330 | |
| 331 | """ |
| 332 | info = _PacketInfo() |
| 333 | info.index = len(cls._packet_infos) |
| 334 | info.src = src_if.sw_if_index |
| 335 | info.dst = dst_if.sw_if_index |
| 336 | if isinstance(dst_if, VppSubInterface): |
| 337 | dst_idx = dst_if.parent.sw_if_index |
| 338 | else: |
| 339 | dst_idx = dst_if.sw_if_index |
| 340 | if dst_idx in cls._packet_count_for_dst_if_idx: |
| 341 | cls._packet_count_for_dst_if_idx[dst_idx] += 1 |
| 342 | else: |
| 343 | cls._packet_count_for_dst_if_idx[dst_idx] = 1 |
| 344 | cls._packet_infos[info.index] = info |
| 345 | return info |
| 346 | |
| 347 | @staticmethod |
| 348 | def info_to_payload(info): |