From patchwork Mon Oct 29 13:03:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 990191 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="3kHmsZZm"; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42kF0C64Zmz9s3Z for ; Mon, 29 Oct 2018 23:53:47 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 4125C3E79CB for ; Mon, 29 Oct 2018 13:53:45 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) by picard.linux.it (Postfix) with ESMTP id 487DE3E790F for ; Mon, 29 Oct 2018 13:53:30 +0100 (CET) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 664BB600748 for ; Mon, 29 Oct 2018 13:53:29 +0100 (CET) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9TChk9k175910 for ; Mon, 29 Oct 2018 12:53:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=sXb00Gf+V+eyFZvKzN3o1wT2xNteBlqTs/L6nwRGaI8=; b=3kHmsZZm0JRnCzXv2waT6kZtiyEwIC/ckLUdmEsfhKP36fgP8M+jzwjPDyML2FyE2xay u3v8U1SIwsETQcEYjCY5orFSHCbP+NBpJZb/prlmZb/4ndM4LVDrnv8m4BKTettmGTDm UkcG0XwwxC7hl8/le47ltJDAQhnvI3+2UrpQoOaE/P5Knl3MPCUHw2pvK//v0zunfI3K QC77kYuLkH0Sf+2wtu8aj05K1S0A9/NBkjSegfGWRr76N5mNJ5nY5Hv47+2267hPrr2H 0E90XdSf7xLZuf3Tt/TEO69EDhVgYO3iP6rMDTXVs7DQCBNgV92PxJRh+JCb8IZ1L1rh 1w== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2ncgnqnc6r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 29 Oct 2018 12:53:27 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w9TCrREG029778 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 29 Oct 2018 12:53:27 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w9TCrQWN031828 for ; Mon, 29 Oct 2018 12:53:27 GMT Received: from ak.ru.oracle.com (/10.162.80.29) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 29 Oct 2018 05:53:26 -0700 From: Alexey Kodanev To: ltp@lists.linux.it Date: Mon, 29 Oct 2018 16:03:19 +0300 Message-Id: <1540818202-11247-4-git-send-email-alexey.kodanev@oracle.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1540818202-11247-1-git-send-email-alexey.kodanev@oracle.com> References: <1540818202-11247-1-git-send-email-alexey.kodanev@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9060 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=839 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810290121 X-Virus-Scanned: clamav-milter 0.99.2 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH 3/6] network/mpls01: new test for mpls labels X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Checks basic functionality (adds/deletes routes), related sysctl parameters. Signed-off-by: Alexey Kodanev --- runtest/net.features | 2 + testcases/network/mpls/Makefile | 10 +++++ testcases/network/mpls/mpls01.sh | 70 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 0 deletions(-) create mode 100644 testcases/network/mpls/Makefile create mode 100755 testcases/network/mpls/mpls01.sh diff --git a/runtest/net.features b/runtest/net.features index de49e76..f858421 100644 --- a/runtest/net.features +++ b/runtest/net.features @@ -60,3 +60,5 @@ geneve01 geneve01.sh geneve01_ipv6 geneve01.sh -6 sit01 sit01.sh + +mpls01 mpls01.sh diff --git a/testcases/network/mpls/Makefile b/testcases/network/mpls/Makefile new file mode 100644 index 0000000..3a54269 --- /dev/null +++ b/testcases/network/mpls/Makefile @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2018 Oracle and/or its affiliates. All Rights Reserved. + +top_srcdir ?= ../../.. + +include $(top_srcdir)/include/mk/testcases.mk + +INSTALL_TARGETS := *.sh + +include $(top_srcdir)/include/mk/generic_leaf_target.mk diff --git a/testcases/network/mpls/mpls01.sh b/testcases/network/mpls/mpls01.sh new file mode 100755 index 0000000..c7788b5 --- /dev/null +++ b/testcases/network/mpls/mpls01.sh @@ -0,0 +1,70 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2018 Oracle and/or its affiliates. All Rights Reserved. + +TST_SETUP="setup" +TST_TESTFUNC="test" +TST_CLEANUP="cleanup" +TST_CNT=3 +TST_MIN_KVER="4.1" +TST_NEEDS_TMPDIR=1 +TST_NEEDS_ROOT=1 +TST_NEEDS_DRIVERS="mpls_router" +TST_NEEDS_CMDS="sysctl modprobe" + +. tst_net.sh + +cleanup() +{ + ip -f mpls route flush dev lo > /dev/null 2>&1 + ip -f mpls route flush dev $(tst_iface) > /dev/null 2>&1 +} + +setup() +{ + ROD modprobe mpls_router +} + +test1() +{ + ROD sysctl -q net.mpls.platform_labels=0xfffff + ROD ip -f mpls route add 0xffffe dev lo + ROD ip -f mpls route show \> /dev/null + ROD ip -f mpls route del 0xffffe dev lo + tst_res TPASS "added label 0xffffe to lo dev" +} + +test2() +{ + ROD sysctl -q net.mpls.platform_labels=0xffffe + ip -f mpls route add 0xffffe dev lo > /dev/null 2>&1 + if [ $? -eq 0 ]; then + tst_res TFAIL "can add label that is >= platform_labels" + return + fi + + tst_res TPASS "can't add label >= platform_lables" +} + +test3() +{ + local start=16 + local end=$((start + NS_TIMES)) + + ROD sysctl -q net.mpls.platform_labels=$((end + 1)) + tst_res TINFO "creating mpls routes with labels from $start..$end" + for l in $(seq $start $end); do + ROD ip -f mpls route add $l dev $(tst_iface) + done + + tst_res TINFO "listing created routes" + ROD ip -f mpls route show \> /dev/null + + tst_res TINFO "removing the routes" + for l in $(seq $start $end); do + ROD ip -f mpls route del $l dev $(tst_iface) + done + tst_res TPASS "created and removed mpls routes" +} + +tst_run