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 5D226A0032; Wed, 14 Sep 2022 09:48:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1DA0740151; Wed, 14 Sep 2022 09:48:15 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 3E00D40141 for ; Wed, 14 Sep 2022 09:48:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663141694; x=1694677694; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=PLfMQujEbDX/FzdPCnYk+XAVKBYZI02lJsLrCqZg5pA=; b=L5k07VkwK0uQkyALY7o8linYO2JRJ27VwsU4LSTqd/Ko/4yCCSWH+6Xm REc9mCpVoAuWJXMMSBA2m36G9wCZckWkRnJcad/XBIqKrwo3AiNPlXucn cdLkqGZXY+t4VbCEMpQAgO2ziG8HHV2Wlq3shWSZ6F1wzDNzd5W8s88rI GidKmPmMIEwzLm59fil0yrgpi7mwT0ztozj3WBeo0rkSK/vi3M396fygE SBL0bOgGnAOilJQjXohz1cS81ykyPP1WAGX5oPTZvZ+vPuo4WtChoTGcR WvvWExh7FAqsAT57AgAJoPpva/BZBfT8NLWGVyo9TazaHmLTLCjc06UWy A==; X-IronPort-AV: E=McAfee;i="6500,9779,10469"; a="278750838" X-IronPort-AV: E=Sophos;i="5.93,313,1654585200"; d="scan'208";a="278750838" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2022 00:48:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,313,1654585200"; d="scan'208";a="742469854" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga004.jf.intel.com with ESMTP; 14 Sep 2022 00:48:12 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 14 Sep 2022 00:48:12 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Wed, 14 Sep 2022 00:48:12 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.47) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Wed, 14 Sep 2022 00:48:12 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m4TNHb7aNMwGsm1TMbOXF+cTHGHKjtm1QCR3HeEHJoA1Ieql3PXSVV8sdjT9sjvH3nMx4Vuhvsbg1cN/A9xktykyXRNq86UYtdZHgHKtLppkfIyE9h5QrqXr4gYYHnZ9QctU84gC/pEwuqzEYkWmURMHQtGolXy4ZNLs7uVYC1aKXqqpGajZP0TcDWdoJPMPGEBp39t2xGnyPVkdT9yzmil7Y/PV6YTRNJS/ow8mN/IxjKxdTHqikuTvTBYVsoVW15BBlC/734hml/uGTXNSFintg8WM0+kbDam1Pgn3NdLHzzH6Z7lWSRwhPI/UPG/AmelCaXk7Wd1Wf2KPl6O51Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vGRcwx5Loy1Kf9jOKmowCiRMOgw3nPvHJnAl0Mf1wxQ=; b=GPlKMcHVWd7POQHW/tGKsguvOjktQeBFPhXWw20C/uSfNC8q2FxPqYgnvpeOKtQf1cQc6S64Y3wzuZ13mnD2/qoVTy4V4/E0RCV89Z/yibYNUVXIbk+Zj29mbOjun/P4a7nXJnGM1dzLqLHif7MS26bekKr2ALUx07P34bNI1Llau3xn5HMx8FLKbV1sQZGcYvFYiaY4CPVADMYErTzBciMQj3WVvZME0uzRK45w9CwhrNefX0l+fJHQLetxniFli0WbVfzEWG9wYXTWNqgQsNPXSlbOHZqv4XyxSVkGdFW26wdiTwqmLm9FOIeo72M47TVJAB7e691l0sN8jgLAVQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MWHPR11MB1629.namprd11.prod.outlook.com (2603:10b6:301:d::21) by SA1PR11MB6992.namprd11.prod.outlook.com (2603:10b6:806:2b6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.22; Wed, 14 Sep 2022 07:48:10 +0000 Received: from MWHPR11MB1629.namprd11.prod.outlook.com ([fe80::13c:8120:d994:16d2]) by MWHPR11MB1629.namprd11.prod.outlook.com ([fe80::13c:8120:d994:16d2%6]) with mapi id 15.20.5612.022; Wed, 14 Sep 2022 07:48:10 +0000 Date: Wed, 14 Sep 2022 08:48:04 +0100 From: Bruce Richardson To: Owen Hilyard CC: Juraj =?utf-8?Q?Linke=C5=A1?= , "Thomas Monjalon" , David Marchand , , Honnappa Nagarahalli , "Tu, Lijuan" , dev Subject: Re: [PATCH v4 6/9] dts: add config parser module Message-ID: References: <20220728100044.1318484-1-juraj.linkes@pantheon.tech> <20220729105550.1382664-1-juraj.linkes@pantheon.tech> <20220729105550.1382664-7-juraj.linkes@pantheon.tech> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: DB9PR01CA0024.eurprd01.prod.exchangelabs.com (2603:10a6:10:1d8::29) To MWHPR11MB1629.namprd11.prod.outlook.com (2603:10b6:301:d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR11MB1629:EE_|SA1PR11MB6992:EE_ X-MS-Office365-Filtering-Correlation-Id: f5798802-c525-4516-6438-08da9625787d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nWinJ5TWdRIEpfi0KsLbRm3GVn9EPVrmt4nFGCNtqDvlrrqC6wgybhpMZW1YYk7qmS1MjCP1IrXU4kx7EqIAtcs3EtGFUlwkIeax9QsR11sN0VdpqrZxJxuoJSF6bSNgQlMRjJ6483vZJID18/GLStLNUuKcKbpJiC3duhk5u8+YUwKQna+MD23nMTftRbBDKRC01ubQztqlaQGebYx2oEQtYXHpUxB5Qa2szgjTN6zN4ixV/8xlWst8lfj7EdaNWR6xWqzup9+gk3PWEYPUZ71Ko05rAaIBWMw2ey/oHU96epnAHTQ3wg7Ace5dxnLFbysTCa3IrKDtdkNkIhlXq6pLcqPjqGvnz3EsySSxURjJ7zenb0tWZdM22b+jzjhIv788Rw0G7Hpi1J+gEqnUyOR5ExCtNA48epbjEsfynzmSkiVAKpVEvyL/fZAhHdJI+HzNqJnCFOLfGNTcJ8xLtL23yrQ1JtXmBamVu9CmDUb63qfd+rpjLlZbvVReXkfUnaxjkTfk+NC2P3zIhphLKCMAtE81bvXEQwHoYA9xkg97bFbmcZ3b2M3vH+ZQ4Z/ZPNESF5q3UWUdd1o30If2J6zZ2WcET+W/yHpLO4R5YrZeFjAh5Cs1utDD3t1RwcPrl7NPhYXvkb80Ek0etksxzbs+6/TeG4lU6Wse/JJ85PL2pLIzRcVpRk9zzlA1wOANytVvc4OExVIFfiK45g3opA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR11MB1629.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(39860400002)(136003)(366004)(396003)(376002)(346002)(451199015)(6506007)(6666004)(66476007)(66556008)(54906003)(2906002)(4326008)(41300700001)(8936002)(8676002)(6916009)(82960400001)(38100700002)(26005)(6512007)(6486002)(86362001)(5660300002)(66946007)(44832011)(478600001)(83380400001)(316002)(186003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?052O88rhMtffl7yHDn1gq19rJyehyE6L+4igwex2wcvji6aNYIxgabeu4kZi?= =?us-ascii?Q?KSBirwv/atrcFRO7TVcfi7EMTnu9rIjDq/EsxhLIP2ga87sVzCuP1XW3RnFV?= =?us-ascii?Q?oVg2hO0O/GRZCEoOdREafcrcVtntQr45D/XzSsa4SzSFd4BQi8eXzdeYSwUr?= =?us-ascii?Q?6PmSdHC2T/swXMl8LgN86KTLhb6UsA8J8/lx5A8Ay0o/TwYp7+eyh9HVLfq0?= =?us-ascii?Q?aYXvECOZ2nrrLRp3DtSYqzWHtExtUmNAsq+h/8KUkS6gSYlMStnLnY1GPxB5?= =?us-ascii?Q?CoShd9mREnGJWgHnHFxgN4UIurFSECuNROohX+t2FLG7z8XP4ZkOrVMU6kqf?= =?us-ascii?Q?z/UJV8YRNcUJre4Xjrqa/z5EefXHzv+jBNt4qNgfOnncpMLhdgHYbwtMszuS?= =?us-ascii?Q?b1PFx7wfwbrZm4YJ8upVSvxaykhCMOc7XOrh1u/F06p87gZU2vHkUzXM+sI9?= =?us-ascii?Q?FuktsNutq3vp4lg56dCsY0rQlyrfSplUd6ebp2hui78Fzu6iGQ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h20Tp/RMjIqdGcQzDA+qjKhtPlofurR0aexzzLq9W3M2TBgEhNjMh3PK?= =?us-ascii?Q?BVxw2mxQkPpayLLjiP3zXnaTa7h2YB+c/fBsHdz9RpiBi/Mr9a92z2tMgqMW?= =?us-ascii?Q?Qyk51rEAL06MSpCq/PXEfSJTZNNHujyxEWwUMn51gVlbF4iVG8byh3mE65vG?= =?us-ascii?Q?E7x82Hpj/svmYw0h14hfOq97NvGi3RTG6fDVs7oknRarW792xZH+NOGiW0/k?= =?us-ascii?Q?Qg=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: f5798802-c525-4516-6438-08da9625787d X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB1629.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2022 07:48:10.6723 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5wuars3WRx0rzNauImGpwDQMJbhPEbTKgyOh7VJCWtbSvLFQkPeQ6kVjwv45S1+LlL8c8bRMQiUzHHdElSGnyBwjzxUJwiScakvUe3ybUGE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB6992 X-OriginatorOrg: intel.com 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 On Tue, Sep 13, 2022 at 01:47:10PM -0400, Owen Hilyard wrote: > > > > +# Frozen makes the object immutable. This enables further > optimizations, > > +# and makes it thread safe should we every want to move in that > direction. > > +@dataclass(slots=True, frozen=True) > > +class NodeConfiguration: > > + name: str > > + hostname: str > > + user: str > > + password: Optional[str] > > + > > + @staticmethod > > + def from_dict(d: dict) -> "NodeConfiguration": > > + return NodeConfiguration( > > + name=d["name"], > > + hostname=d["hostname"], > > + user=d["user"], > > + password=d.get("password"), > > + ) > > + > Out of curiosity, what is the reason for having a static "from_dict" > method > rather than just a regular constructor function that takes a dict as > parameter? > > @dataclass(...) is a class annotation that transforms the thing it > annotates into a dataclass. This means it creates the constructor for > you based on the property type annotations. If you create your own > constructor, you need a constructor that can either take a single > dictionary or all of the parameters like a normal constructor. Making > it a static method also means that each class can manage how it should > be constructed from a dictionary. Some of the other classes will > transform lists or perform other assertions. It also makes it easier to > have specialized types. For instance, a NICConfiguration class would > have to handle all of the possible device arguments that could be > passed to any PMD driver if things were passed as parameters. > > > + > > +@dataclass(slots=True, frozen=True) > > +class ExecutionConfiguration: > > + system_under_test: NodeConfiguration > > + > Minor comment: seems strange having only a single member variable in > this > class, effectively duplicating the class above. > > More is intended to go here. For instance, what tests to run, > configuration for virtual machines, the traffic generator node. > > > Thanks for all the explanations.