From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EC33C424CA; Tue, 11 Jun 2024 12:46:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B94244021E; Tue, 11 Jun 2024 12:46:35 +0200 (CEST) Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by mails.dpdk.org (Postfix) with ESMTP id A0632400D6 for ; Tue, 11 Jun 2024 12:46:32 +0200 (CEST) Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-42189d3c7efso21034805e9.2 for ; Tue, 11 Jun 2024 03:46:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pantheon.tech; s=google; t=1718102792; x=1718707592; darn=dpdk.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=TI712o3tWHJrlc336PDsquazTPF+ChmBAJksQikcuRg=; b=i4+usMNG86b2q8zchDdwm/3pL9vPVMBamO4YL7/XL9CVCK/4G9h42kSgWUbr0ourOn RA19eljk6CV+pvhMmTsGBF12seNlADfEWpb4CgkcazrPeh2AHIVdOeGgFe4XSjw7/KOO Ef2+MwDjU9UXU3UvGRG4wD8xvbAUbdlgyJWytDAmVM2NaZEMEVgHQrk7QlQo9nB9dieN CTLV86tuEQYtUjkIRkRi42M7KlFVS4Q/7EeNdhDcmaP9ydGCSu727kaJ+atrcJar2dHu j4LN2eOYzdBIJLPE4wXbslHhymXqi5deDuLujEXwPrwtJ7diDaHFobUKfMtrPndlPZc+ gnPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718102792; x=1718707592; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TI712o3tWHJrlc336PDsquazTPF+ChmBAJksQikcuRg=; b=VxEq/FGl904tfPvp7tCbQebEHJW5jAifEZrBy9QSOZqkh1eBsasSyiig0LN2JHF5mx 0NjYAxYyKCCWhtNeTPrjWgtjzjyzO0jrA2gt29uohR76sUmyb7csjprqLo0OxsGlHEq/ IYZhuSuTpnfo1BZNijSaiV/j70QkN1k7cpezBSEW9dWDKdtT536W1KDyKPyPUbFEzYS5 Qa8BaGNaoHQykVgb3lUla8R6/U7sqVOCE+1SSx+zHsRs+e7AAZiqpI5zNxC+/gwgaMyp lVUgS10b3tppLd/4n0dXo+uOhamnI2JFDkgirUvqsDi8k9PCg+q/xab35F/kw2t0miGW V7WA== X-Gm-Message-State: AOJu0YxhF3APDaukABjyPg+kAcsVmZE2nLOHaVlJ0FMDW+oA2ivWhkvw OkEdBcIVfbIsEP6PK3pTbg5HlSlecEeCFSZ0t1ko7hM43tPIzx9YXfbrRye+al8= X-Google-Smtp-Source: AGHT+IHqMzRnTRE77cyHhzQNiV1sVl5pZJsArl2ib5Eh7Y6Z0WA9pmqnbdBHDxHxguT45gU/Dk++Kg== X-Received: by 2002:a05:600c:4ece:b0:421:7bb1:eb9b with SMTP id 5b1f17b1804b1-4217bb1efebmr67870455e9.28.1718102792225; Tue, 11 Jun 2024 03:46:32 -0700 (PDT) Received: from [10.12.0.137] (81.89.53.154.host.vnet.sk. [81.89.53.154]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-421ff76799esm51266485e9.32.2024.06.11.03.46.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Jun 2024 03:46:31 -0700 (PDT) Message-ID: <206dba88-bb36-4bcd-9a21-2558ee35b426@pantheon.tech> Date: Tue, 11 Jun 2024 12:46:30 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH v1 2/2] dts: Remove XML-RPC server for Scapy TG and instead us ScapyShell To: jspewock@iol.unh.edu, Luca.Vizzarro@arm.com, probb@iol.unh.edu, npratte@iol.unh.edu, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com, thomas@monjalon.net, wathsala.vithanage@arm.com, Honnappa.Nagarahalli@arm.com Cc: dev@dpdk.org References: <20240605175227.7003-1-jspewock@iol.unh.edu> <20240605175227.7003-3-jspewock@iol.unh.edu> Content-Language: en-US From: =?UTF-8?Q?Juraj_Linke=C5=A1?= In-Reply-To: <20240605175227.7003-3-jspewock@iol.unh.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > diff --git a/dts/framework/testbed_model/traffic_generator/scapy.py b/dts/framework/testbed_model/traffic_generator/scapy.py > index 5676235119..2b299ad02f 100644 > --- a/dts/framework/testbed_model/traffic_generator/scapy.py > +++ b/dts/framework/testbed_model/traffic_generator/scapy.py > > class ScapyTrafficGenerator(CapturingTrafficGenerator): > - """Provides access to scapy functions via an RPC interface. > + """Provides access to scapy functions on a traffic generator. > traffic generator node > This class extends the base with remote execution of scapy functions. > > - Any packets sent to the remote server are first converted to bytes. They are received as > - :class:`~xmlrpc.client.Binary` objects on the server side. When the server sends the packets > - back, they are also received as :class:`~xmlrpc.client.Binary` objects on the client side, are > - converted back to :class:`~scapy.packet.Packet` objects and only then returned from the methods. > + All processing of packets is handled via an instance of a > + :class:`framework.remote_session.scapy_shell.ScapyShell` that runs on the underlying > + :class:`framework.testbed_model.tg_node.TGNode`. > The module docstring should also be updated. > Attributes: > session: The exclusive interactive remote session created by the Scapy > - traffic generator where the XML-RPC server runs. > - rpc_server_proxy: The object used by clients to execute functions > - on the XML-RPC server. > + traffic generator. > """ > > - session: PythonShell > - rpc_server_proxy: xmlrpc.client.ServerProxy > + session: ScapyShell > _config: ScapyTrafficGeneratorConfig > > def __init__(self, tg_node: Node, config: ScapyTrafficGeneratorConfig): > """Extend the constructor with Scapy TG specifics. > > - The traffic generator first starts an XML-RPC on the remote `tg_node`. > - Then it populates the server with functions which use the Scapy library > - to send/receive traffic: > - > - * :func:`scapy_send_packets_and_capture` > - * :func:`scapy_send_packets` > - > - To enable verbose logging from the xmlrpc client, use the :option:`--verbose` > - command line argument or the :envvar:`DTS_VERBOSE` environment variable. > + The traffic generator starts an underlying session that handles scapy interactions > + that it will use in its provided methods. > I'm not sure what you're trying to say here - that the methods the tg exposes are using the scapy session? > Args: > tg_node: The node where the traffic generator resides. > @@ -262,50 +62,11 @@ def __init__(self, tg_node: Node, config: ScapyTrafficGeneratorConfig): > ), "Linux is the only supported OS for scapy traffic generation" > > self.session = self._tg_node.create_interactive_shell( Looks like in this specific case, we could do this with multiple inheritance instead of composition. Composition is needed in the other use cases, since we use different objects based on the config (e.g. Linux or Windows session). Here, we're always going to use the same object (ScapyShell). The code would need to be refactored to achieve multiple inheritance (the __init__ methods would probably have to accept extra kwargs) and Luca's testpmd params patch would help a lot, as that looks at least somewhat suitable. I don't know how well would multiple inheritance work, if at all, but it's worth trying so that we don't have to basically copy-paste the same method signature over and over (e.g. _send_packets and send_packets in ScapyTrafficGenerator and ScapyShell).