From 80de976205651cb15fc3203ebac4ec198aad7ec6 Mon Sep 17 00:00:00 2001 From: Fabian Ruffy <5960321+fruffy@users.noreply.github.com> Date: Fri, 16 Jun 2023 15:39:33 -0400 Subject: [PATCH 1/2] Add flags to nanomsg send/receive calls. --- src/ptf/dataplane.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ptf/dataplane.py b/src/ptf/dataplane.py index fd250fe..30bf84a 100644 --- a/src/ptf/dataplane.py +++ b/src/ptf/dataplane.py @@ -249,9 +249,9 @@ def fileno(self): """ return self.socket.getsockopt(nnpy.SOL_SOCKET, nnpy.RCVFD) - def __send_port_msg(self, msg_type, port_number, more): + def __send_port_msg(self, msg_type, port_number, more, flags=0): hdr = struct.pack(" Date: Fri, 16 Jun 2023 15:41:19 -0400 Subject: [PATCH 2/2] Fix regression --- src/ptf/dataplane.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/ptf/dataplane.py b/src/ptf/dataplane.py index 30bf84a..1f5dcbb 100644 --- a/src/ptf/dataplane.py +++ b/src/ptf/dataplane.py @@ -321,10 +321,7 @@ def send(self, port_number, packet): packet, ) # because nnpy expects unicode when using str - if sys.version_info[0] == 2: - msg = list(msg) - else: - msg = bytearray(msg) + msg = bytearray(msg) self.socket.send(msg) # nnpy does not return the number of bytes sent return len(packet)