Skip to content

[Bug report] dataplane poll with default port_number doesn't work when there are multiple ptf nn agents #207

@w1nda

Description

@w1nda

Source code: #

self, device_number=0, port_number=None, timeout=None, exp_pkt=None, filters=[]

Simplified code:

    def poll(
        self, device_number=0, port_number=None, timeout=None, exp_pkt=None, filters=[]
    ):
        def grab():
            self.logger.debug("Grabbing packet")
            for rcv_port_number, pkt, time in self.packets(device_number, port_number):
                rcv_device_number = device_number
                if not exp_pkt or match_exp_pkt(exp_pkt, pkt):
                    return DataPlane.PollSuccess(
                        rcv_device_number, rcv_port_number, pkt, exp_pkt, time
                    )
            return None

        with self.cvar:
            ret = ptfutils.timed_wait(self.cvar, grab, timeout=timeout)

        return ret

The problem is:
when there are multiple ptf nn agents connecting the dataplane, there will be equvilent count of "device numbers", however, when we call poll with port_number=None, it will only poll packet from the device with number 0.

That doesn't make sense, when exp_pkt is not none and port number is none, we should poll packets from all devices.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions