From patchwork Sat Sep 26 11:27:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Dziedzic X-Patchwork-Id: 1371747 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=3FiMewRB; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=KcKvskCf; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bz63Y303bz9sSG for ; Sat, 26 Sep 2020 21:28:25 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=xxc1vsaopI/d57JQGND0KsMnWbPUi58Mcu970Cbkl2k=; b=3FiMewRBJMtvsyLV2Q+HmlMsNt EWg2zhGEpP0XpIrasBPPlI77+Z/LdaYvDiyKq7mgno4ZJkpVkKRC5OIJmx0yuMF4MILKYXpsZCwEu +mUQzYDCNeGJr74SsILLZXwa9BWduM2/kWsLx0ZurKyZl8A/Vs8lAPmNPffFpnkZWLsq7KZiBfdTr YBXjBtnbxyA031DzcnsWj9qCi6xwrUB8c0mxZBi+5Q+/s0wNcNQnD9qb14C43KuA7Kr1fCj94W+eh oaMTDrkeSPZiWGzwjUM8SbvK2lcn3uCEjby80foQlVbtr0Y5bGPHOrxyC1H8udH78er3JuGN3T0yd A73Q5o4A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kM8Mi-0002sN-DE; Sat, 26 Sep 2020 11:27:44 +0000 Received: from mail-lj1-x242.google.com ([2a00:1450:4864:20::242]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kM8Mc-0002qJ-06 for hostap@lists.infradead.org; Sat, 26 Sep 2020 11:27:38 +0000 Received: by mail-lj1-x242.google.com with SMTP id k25so4582786ljk.0 for ; Sat, 26 Sep 2020 04:27:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=o0lVar17u1Dr3TfYTZ+GryZE6cNUPVWA78uzr3uDQw8=; b=KcKvskCfkmsM/nIOkGvARefgDDaKXmLkYPvuLHRe0fkomBw7kwkYB24qAA0ly0rSen Ow5ztYVF3Jyh9eBq/oRTIMwsbOy2n8Sv6PySYRebZf9ZgaVdxT8n8WLZT15BC3IHAWJY bSjfi/w0yvPwOxCsU7o2H94PzRNHuqJOwmG0bobtH0rghpRKv79WmhdZ0uLx+rq8OCAK cZ9MOqEhkDoiY7tQ/5pkBrtY1NrwhpWTH+5B7v+o3hd6Gaqrp5+LVdJXuI5KXLdHPTsg eniquHiBXSQB2iEs9EJVnK2kwy5R73m0k3rkXGak642pqv/CN30bP2P/WCh4hHPMubMS kc+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=o0lVar17u1Dr3TfYTZ+GryZE6cNUPVWA78uzr3uDQw8=; b=UtCedbfMurfvnjYpHfOO/TPSclNifygb/udGEYKdYGuNHOfu8d+nFTp5OAJqLu2pKY VxrapuMG73BXiJpo71i58Tgvd4TNLFbZpzYNhcWWh9prGO3telwPk4MSXfu3ZcHURLh0 hWYFy5VVy3vNHIIshN5Jn51MX7iRd1V/UETJriAl95aVmgjsn1b/NV4IYtqh4qj3rF7k A1IqGtoxVga8eA6ghSYbtoV4wjCLkSQ/pm9PQQ51YNHtyhKJJcuceFuBioPpY+yBfri9 nIhRYO4yiInENs87g40jfCSjribDnvQIDCZKgTgO5M0gzPmXsGKc+NUplzRTeDYbYSJ8 Ppdg== X-Gm-Message-State: AOAM531FkTJI6tLqefE2s3okk+C2OCCGqzUep2qa0Ws8qhDl4gmXxdKu uW8wj1NYg4lyzh3PfIcKIK3LWKIrr7k= X-Google-Smtp-Source: ABdhPJzqxiR0kU+chBDcPIvABzc9UvKuTVuqiKUC9iBUHZXz5U+oE0YGawy+ZCG5m9ZBV8S8RsHEEg== X-Received: by 2002:a2e:9212:: with SMTP id k18mr2844948ljg.241.1601119656277; Sat, 26 Sep 2020 04:27:36 -0700 (PDT) Received: from localhost.localdomain ([62.141.212.102]) by smtp.gmail.com with ESMTPSA id n9sm1478110lfd.215.2020.09.26.04.27.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Sep 2020 04:27:35 -0700 (PDT) From: Janusz Dziedzic To: hostap@lists.infradead.org Subject: [PATCH 9/9] tests: remote: add run_monitor test case Date: Sat, 26 Sep 2020 13:27:00 +0200 Message-Id: <20200926112700.6055-9-janusz.dziedzic@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200926112700.6055-1-janusz.dziedzic@gmail.com> References: <20200926112700.6055-1-janusz.dziedzic@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200926_072738_092845_AD9FF373 X-CRM114-Status: GOOD ( 16.32 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:242 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [janusz.dziedzic[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: j@w1.fi, Janusz Dziedzic MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This is usefull to run monitor quickly: ./run-tests.py -t run_monitor -m mon:36,20,36,0:1,20,1,0 In such example we will get one PCAP for 36/20 and 1/20. After execution, PCAP file is in log directory, eg: ./logs/2019_11_11_13_36_24/run_monitor_mon_wlp3s0_wlp5s0.pcap Signed-off-by: Janusz Dziedzic --- tests/remote/test_monitor.py | 52 ++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 tests/remote/test_monitor.py diff --git a/tests/remote/test_monitor.py b/tests/remote/test_monitor.py new file mode 100644 index 000000000..55187fb7d --- /dev/null +++ b/tests/remote/test_monitor.py @@ -0,0 +1,52 @@ +# Monitor support +# +# This software may be distributed under the terms of the BSD license. +# See README for more details. + +import remotehost +import config +import rutils +import monitor +import time +import os + +import logging +logger = logging.getLogger() + +def run_monitor(devices, setup_params, refs, duts, monitors, seconds = None): + try: + air_monitor = [] + output = "\n\tPCAP files:\n" + # setup log dir + local_log_dir = setup_params['local_log_dir'] + + # add/run monitors if requested + air_monitors = monitor.create(devices, setup_params, refs, duts, + monitors) + for air_monitor in air_monitors: + monitor.setup(air_monitor) + monitor.run(air_monitor, setup_params) + logger.warning(air_monitor.name + " - monitor started ...") + + if seconds != None: + time.sleep(int(seconds)) + else: + input("\tPress Enter to end ailogs capturing...") + + # destroy monitor / get pcap + monitor.destroy(devices, air_monitors) + for air_monitor in air_monitors: + for log in air_monitor.logs: + head, tail = os.path.split(log) + output = output + "\t" + local_log_dir + "/" + tail + "\n" + air_monitor.get_logs(local_log_dir) + return output + except: + for air_monitor in air_monitors: + monitor.destroy(devices, air_monitors) + air_monitor.get_logs(local_log_dir) + raise + +def test_run_monitor(devices, setup_params, refs, duts, monitors): + """TC run standalone monitor""" + return run_monitor(devices, setup_params, refs, duts, monitors)