From patchwork Thu Apr 2 03:25:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankur Sharma X-Patchwork-Id: 1265421 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=nutanix.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=proofpoint20171006 header.b=SMbJAOjA; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48t7km6Pxdz9sRN for ; Thu, 2 Apr 2020 14:26:08 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 3FADA86F1B; Thu, 2 Apr 2020 03:26:06 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YUEhjqy4sSWV; Thu, 2 Apr 2020 03:26:05 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 1FB0586DCA; Thu, 2 Apr 2020 03:26:05 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 055DAC1D7F; Thu, 2 Apr 2020 03:26:05 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id EDFEFC089F for ; Thu, 2 Apr 2020 03:26:03 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id C836B2624F for ; Thu, 2 Apr 2020 03:26:03 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id U1wlBoi3rWrZ for ; Thu, 2 Apr 2020 03:25:57 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mx0b-002c1b01.pphosted.com (mx0b-002c1b01.pphosted.com [148.163.155.12]) by silver.osuosl.org (Postfix) with ESMTPS id 07D07261F9 for ; Thu, 2 Apr 2020 03:25:55 +0000 (UTC) Received: from pps.filterd (m0127841.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0323PtZm014819 for ; Wed, 1 Apr 2020 20:25:55 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=proofpoint20171006; bh=oMnQ0W3NevIOgli/2bNiO3oKyeCMUlRI1fc3L1SBisw=; b=SMbJAOjA2tMaz4pZlFJ1kFgpJV7VDLobo3OwZVHs9Z5S9ahAkRbqjAllgCDbCMd9nObT nsWim5HmwMVr9h6rsJUFcNB61hFTP/MVYW5qtpTULmRDJzOnFezMuRZWGuIAdTGkOOOy mFkfekRQrWg/GwIiklMEbKV0CZKGX6j23jD1E2Ylm2Uj2pKnuftaV1uHPb6HuG+DQlZT 3ezNw1WvGKXT7QCBI1Z/MNi83h4xQD0PSUQzSGksYZ/yN8Q4GAMotGoHR1GQfkDHVhQw py8jtH7sKExvoUmbivTjb6G0cnZ2b60AW2sENLA5aaKMfyHimU6+4AX7lp37nRM2jINi MQ== Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2174.outbound.protection.outlook.com [104.47.59.174]) by mx0b-002c1b01.pphosted.com with ESMTP id 30244a9u2q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 01 Apr 2020 20:25:55 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hn4EfqEMTYxknKzTM4dX0/NlonNfVRR0VRunsfOeN0Z6pbD1uX3Loa4CRPrRrUHAGTLLEfDL0T06tbT0bcBzakfJM1lh4W2lRJqPn81uauytDZhUr9AIoYe5Ke67pqsgaei8yAyT4Vtbu0MXgcFeVZ3d92T34ACKNZN7wqZuu76n4CAg/Xe2bYw0UOKjb7soC8EIz0f0DjXYlVrCWLGeWdjmnA2gwialF0F9+YqOMRDJVmIc/1xmgABI2ZnuXHsqKXeTycdaVyk91PFrXCqAruxrggSvr8N31izwdp8U6tavscnpiq6da9qnWHAq8LJrV6pl/N0slLoydUQhjxYHGg== 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-SenderADCheck; bh=oMnQ0W3NevIOgli/2bNiO3oKyeCMUlRI1fc3L1SBisw=; b=fGGtFsaS8tw1TJTF8MTmHVR9Mu1hTXXWUHwUUmkk/W78pXSMoK6XRfrOpCe7dCrpBcbpRj96YOs7bP1pDZTaaPYdv9sotU15MAnWCKx4URD/cUYDtkna0G5f/eDfVdWnRm1hrCX0Uv0ToC5WA9afF1zNE0HGi+6v1V9su+6e10fGvknf7icsVWLRrtThqqeuDm7mT3w3Fh287aGlNKUcilNWeyhm+B5D2b4XCEN0fJFqQ/K6OiCZNzKN82xb5Szx7zTIBaxgmUxgPjFsyMC6xaFr/pTNZ3jVAkPYSL9PJrvljKzpBCEkU1by/RQsmDfwOHQsF8aRew2JU8H4mg40Gg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none Received: from BL0PR02MB3714.namprd02.prod.outlook.com (2603:10b6:207:44::16) by BL0PR02MB4674.namprd02.prod.outlook.com (2603:10b6:208:2b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.20; Thu, 2 Apr 2020 03:25:53 +0000 Received: from BL0PR02MB3714.namprd02.prod.outlook.com ([fe80::c43f:ba9f:6c04:d0fb]) by BL0PR02MB3714.namprd02.prod.outlook.com ([fe80::c43f:ba9f:6c04:d0fb%7]) with mapi id 15.20.2878.016; Thu, 2 Apr 2020 03:25:53 +0000 From: Ankur Sharma To: ovs-dev@openvswitch.org Date: Wed, 1 Apr 2020 20:25:27 -0700 Message-Id: <1585797927-16739-3-git-send-email-svc.mail.git@nutanix.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1585797927-16739-1-git-send-email-svc.mail.git@nutanix.com> References: <1585797927-16739-1-git-send-email-svc.mail.git@nutanix.com> X-ClientProxiedBy: BYAPR11CA0066.namprd11.prod.outlook.com (2603:10b6:a03:80::43) To BL0PR02MB3714.namprd02.prod.outlook.com (2603:10b6:207:44::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from northd.localdomain (192.146.154.98) by BYAPR11CA0066.namprd11.prod.outlook.com (2603:10b6:a03:80::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.20 via Frontend Transport; Thu, 2 Apr 2020 03:25:52 +0000 X-Mailer: git-send-email 1.8.3.1 X-Originating-IP: [192.146.154.98] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a8edd74d-4b6d-40ef-7755-08d7d6b58c88 X-MS-TrafficTypeDiagnostic: BL0PR02MB4674: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-proofpoint-crosstenant: true X-MS-Oob-TLC-OOBClassifiers: OLM:173; X-Forefront-PRVS: 0361212EA8 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BL0PR02MB3714.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10019020)(396003)(366004)(136003)(39860400002)(376002)(346002)(8936002)(81156014)(52116002)(6916009)(6506007)(66476007)(36756003)(66574012)(81166006)(956004)(478600001)(107886003)(2906002)(5660300002)(8676002)(6666004)(2616005)(26005)(86362001)(66556008)(6486002)(16526019)(316002)(54906003)(186003)(4326008)(66946007)(6512007); DIR:OUT; SFP:1102; Received-SPF: None (protection.outlook.com: nutanix.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ornh46JMmr78/XGJOGC+2V4FdCTiD2vac1//l+k69UejTtstoWVM7f2Zde/re0FPa531m2e6F0NPCee1pscPPkho/L//MyXcZ9A1Sv41insAsrwnxBrQ1/mA49egxxbLqKMsbp4DYD7I6RgATWDvb8sgG3dyJkv1B8H4deK7MElRWxFKbT5Tkpc/c0cl/Qqk750Tvg/vRKKnp1EgLUW0m1xTEey+STmKmIoXxnIwElFlPXre/NcJJbjRQdlDBsAR7OUkKMSIPcEc8cwP0KPD4FOOishwV85p0ac/hdVLt3BdnY2/kc/6UVJu/+t61214zVPdHtQWtZrJglsNstaODxZcKuW2LcMk96j492F2Bz9uSLhlU7vNyREfWEs6n52QfRs/0kH2wBW7vgKWwwmMaJli6lWIXjj/fDInrZ4twgm6JaS5rs2YybA3p/E7IISZ X-MS-Exchange-AntiSpam-MessageData: lVYHryEB7FeA3DPvUjydAPmIzySTE2YxNKWh062lUWYGaDGtubO8MNT6TNwFofaRZ92jvSm+gCoGpmW2IeC9pw71z2YVm/tB0xeyvNf2IcIwarS+POBT5ujpR95es+SNUscVIQDAhe9Gan9O3wgXaQ== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8edd74d-4b6d-40ef-7755-08d7d6b58c88 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2020 03:25:53.3581 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ryXtiJHVnZD9e4hdcf7D37AAE7YrJvbdljM4WWNINs/RT4G5ftFNXGEWmk8jszgrj204jLCgADgEf3TzzNv8wa1zQk2o07JNzq+5cfoyY9Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR02MB4674 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-01_04:2020-03-31, 2020-04-01 signatures=0 X-Proofpoint-Spam-Reason: safe Cc: Ankur Sharma Subject: [ovs-dev] [PATCH v2 2/2 ovn] NAT: Northd and parser changes to support port range X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" This patch has northd changes to put port range in the logical flow based on configuration. Port range is NOT applicable for stateless dnat_and_snat rules. Changes to parse the logical flow, which specifies port_range for ct_nat action. Example logical flow: ct_snat(10.15.24.135,1-30000) Signed-off-by: Ankur Sharma --- include/ovn/actions.h | 7 ++++++ include/ovn/lex.h | 1 + lib/actions.c | 43 ++++++++++++++++++++++++++++++++++ lib/lex.c | 5 +++- northd/ovn-northd.c | 31 +++++++++++++++++++++---- tests/ovn-northd.at | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/ovn.at | 28 ++++++++++++++++++++-- 7 files changed, 171 insertions(+), 8 deletions(-) diff --git a/include/ovn/actions.h b/include/ovn/actions.h index 9b01492..2cec369 100644 --- a/include/ovn/actions.h +++ b/include/ovn/actions.h @@ -233,6 +233,13 @@ struct ovnact_ct_nat { struct in6_addr ipv6; ovs_be32 ipv4; }; + + struct { + bool exists; + uint16_t port_lo; + uint16_t port_hi; + } port_range; + uint8_t ltable; /* Logical table ID of next table. */ }; diff --git a/include/ovn/lex.h b/include/ovn/lex.h index 8d55857..1da6ccc 100644 --- a/include/ovn/lex.h +++ b/include/ovn/lex.h @@ -63,6 +63,7 @@ enum lex_type { LEX_T_EXCHANGE, /* <-> */ LEX_T_DECREMENT, /* -- */ LEX_T_COLON, /* : */ + LEX_T_HYPHEN, /* - */ }; /* Subtype for LEX_T_INTEGER and LEX_T_MASKED_INTEGER tokens. diff --git a/lib/actions.c b/lib/actions.c index 6351db7..e06bce6 100644 --- a/lib/actions.c +++ b/lib/actions.c @@ -770,6 +770,33 @@ parse_ct_nat(struct action_context *ctx, const char *name, } lexer_get(ctx->lexer); + if (lexer_match(ctx->lexer, LEX_T_COMMA)) { + + if (ctx->lexer->token.type != LEX_T_INTEGER || + ctx->lexer->token.format != LEX_F_DECIMAL) { + lexer_syntax_error(ctx->lexer, "expecting Integer for port " + "range"); + } + + cn->port_range.port_lo = ntohll(ctx->lexer->token.value.integer); + lexer_get(ctx->lexer); + + if (lexer_match(ctx->lexer, LEX_T_HYPHEN)) { + + if (ctx->lexer->token.type != LEX_T_INTEGER) { + lexer_syntax_error(ctx->lexer, "expecting Integer for port " + "range"); + } + cn->port_range.port_hi = ntohll( + ctx->lexer->token.value.integer); + lexer_get(ctx->lexer); + } else { + cn->port_range.port_hi = 0; + } + + cn->port_range.exists = true; + } + if (!lexer_force_match(ctx->lexer, LEX_T_RPAREN)) { return; } @@ -799,6 +826,17 @@ format_ct_nat(const struct ovnact_ct_nat *cn, const char *name, struct ds *s) ipv6_format_addr(&cn->ipv6, s); ds_put_char(s, ')'); } + + if (cn->port_range.exists) { + ds_chomp(s, ')'); + ds_put_format(s, ",%d", cn->port_range.port_lo); + + if (cn->port_range.port_hi) { + ds_put_format(s, "-%d", cn->port_range.port_hi); + } + ds_put_char(s, ')'); + } + ds_put_char(s, ';'); } @@ -861,6 +899,11 @@ encode_ct_nat(const struct ovnact_ct_nat *cn, } } + if (cn->port_range.exists) { + nat->range.proto.min = cn->port_range.port_lo; + nat->range.proto.max = cn->port_range.port_hi; + } + ofpacts->header = ofpbuf_push_uninit(ofpacts, nat_offset); ct = ofpacts->header; if (cn->family == AF_INET || cn->family == AF_INET6) { diff --git a/lib/lex.c b/lib/lex.c index 7a2ab41..94f6c77 100644 --- a/lib/lex.c +++ b/lib/lex.c @@ -301,6 +301,9 @@ lex_token_format(const struct lex_token *token, struct ds *s) case LEX_T_COLON: ds_put_char(s, ':'); break; + case LEX_T_HYPHEN: + ds_put_char(s, '-'); + break; default: OVS_NOT_REACHED(); } @@ -757,7 +760,7 @@ next: token->type = LEX_T_DECREMENT; p++; } else { - lex_error(token, "`-' is only valid as part of `--'."); + token->type = LEX_T_HYPHEN; } break; diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index 0762781..71d420d 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -8849,7 +8849,13 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, is_v6 ? "6" : "4", nat->logical_ip); } else { ds_put_format(&actions, "flags.loopback = 1; " - "ct_dnat(%s);", nat->logical_ip); + "ct_dnat(%s", nat->logical_ip); + + if (strlen(nat->external_port_range)) { + ds_put_format(&actions, ",%s", + nat->external_port_range); + } + ds_put_format(&actions, ");"); } ovn_lflow_add_with_hint(lflows, od, S_ROUTER_IN_DNAT, 100, @@ -8877,8 +8883,12 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, ds_put_format(&actions, "ip%s.dst=%s; next;", is_v6 ? "6" : "4", nat->logical_ip); } else { - ds_put_format(&actions, "ct_dnat(%s);", - nat->logical_ip); + ds_put_format(&actions, "ct_dnat(%s", nat->logical_ip); + if (strlen(nat->external_port_range)) { + ds_put_format(&actions, ",%s", + nat->external_port_range); + } + ds_put_format(&actions, ");"); } ovn_lflow_add_with_hint(lflows, od, S_ROUTER_IN_DNAT, 100, @@ -8982,8 +8992,14 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, ds_put_format(&actions, "ip%s.src=%s; next;", is_v6 ? "6" : "4", nat->external_ip); } else { - ds_put_format(&actions, "ct_snat(%s);", + ds_put_format(&actions, "ct_snat(%s", nat->external_ip); + + if (strlen(nat->external_port_range)) { + ds_put_format(&actions, ",%s", + nat->external_port_range); + } + ds_put_format(&actions, ");"); } /* The priority here is calculated such that the @@ -9020,8 +9036,13 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, ds_put_format(&actions, "ip%s.src=%s; next;", is_v6 ? "6" : "4", nat->external_ip); } else { - ds_put_format(&actions, "ct_snat(%s);", + ds_put_format(&actions, "ct_snat(%s", nat->external_ip); + if (strlen(nat->external_port_range)) { + ds_put_format(&actions, ",%s", + nat->external_port_range); + } + ds_put_format(&actions, ");"); } /* The priority here is calculated such that the diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index d127152..8cc3f70 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -1074,6 +1074,70 @@ AT_CHECK([ovn-sbctl dump-flows R1 | grep ip6.src=| wc -l], [0], [2 AT_CLEANUP +AT_SETUP([ovn -- check portrange dnat, snat and dnat_and_snat rules]) +ovn_start + +ovn-sbctl chassis-add gw1 geneve 127.0.0.1 + +ovn-nbctl lr-add R1 +ovn-nbctl lrp-add R1 R1-S1 02:ac:10:01:00:01 172.16.1.1/24 + +ovn-nbctl ls-add S1 +ovn-nbctl lsp-add S1 S1-R1 +ovn-nbctl lsp-set-type S1-R1 router +ovn-nbctl lsp-set-addresses S1-R1 router +ovn-nbctl --wait=sb lsp-set-options S1-R1 router-port=R1-S1 + +ovn-nbctl lrp-set-gateway-chassis R1-S1 gw1 + +uuid=`ovn-sbctl --columns=_uuid --bare find Port_Binding logical_port=cr-R1-S1` +echo "CR-LRP UUID is: " $uuid + +# IPV4 +ovn-nbctl --portrange lr-nat-add R1 dnat_and_snat 172.16.1.1 50.0.0.11 1-3000 + +OVS_WAIT_UNTIL([test 2 = `ovn-sbctl dump-flows R1 | grep lr_in_unsnat | \ +wc -l`]) + +AT_CHECK([ovn-sbctl dump-flows R1 | grep ct_snat | grep 3000 | wc -l], [0], [1 +]) + +AT_CHECK([ovn-sbctl dump-flows R1 | grep ct_dnat | grep 3000 | wc -l], [0], [1 +]) + + +ovn-nbctl lr-nat-del R1 dnat_and_snat 172.16.1.1 + +ovn-nbctl --portrange lr-nat-add R1 snat 172.16.1.1 50.0.0.11 1-3000 + +OVS_WAIT_UNTIL([test 2 = `ovn-sbctl dump-flows R1 | grep lr_in_unsnat | \ +wc -l`]) + +AT_CHECK([ovn-sbctl dump-flows R1 | grep ct_snat | grep 3000 | wc -l], [0], [1 +]) + +AT_CHECK([ovn-sbctl dump-flows R1 | grep ct_dnat | grep 3000 | wc -l], [0], [0 +]) + +ovn-nbctl lr-nat-del R1 snat 172.16.1.1 + +ovn-nbctl --portrange --stateless lr-nat-add R1 dnat_and_snat 172.16.1.2 50.0.0.12 1-3000 +ovn-sbctl dump-flows R1 + +OVS_WAIT_UNTIL([test 3 = `ovn-sbctl dump-flows R1 | grep lr_in_unsnat | \ +wc -l`]) + +AT_CHECK([ovn-sbctl dump-flows R1 | grep ct_snat | grep 3000 | grep 172.16.1.2 | wc -l], [0], [0 +]) + +AT_CHECK([ovn-sbctl dump-flows R1 | grep ct_dnat | grep 3000 | grep 172.16.1.2 | wc -l], [0], [0 +]) + + +ovn-nbctl lr-nat-del R1 dnat_and_snat 172.16.1.1 + +AT_CLEANUP + AT_SETUP([ovn -- check Load balancer health check and Service Monitor sync]) AT_SKIP_IF([test $HAVE_PYTHON = no]) ovn_start diff --git a/tests/ovn.at b/tests/ovn.at index 0135838..b79942a 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -1049,15 +1049,27 @@ ct_dnat(192.168.1.2); ct_dnat(fd11::2); encodes as ct(commit,table=19,zone=NXM_NX_REG11[0..15],nat(dst=fd11::2)) has prereqs ip +ct_dnat(192.168.1.2, 1-3000); + formats as ct_dnat(192.168.1.2,1-3000); + encodes as ct(commit,table=19,zone=NXM_NX_REG11[0..15],nat(dst=192.168.1.2:1-3000)) + has prereqs ip ct_dnat(192.168.1.2, 192.168.1.3); - Syntax error at `,' expecting `)'. + Syntax error at `192.168.1.3' expecting Integer for port range. ct_dnat(foo); Syntax error at `foo' expecting IPv4 or IPv6 address. ct_dnat(foo, bar); Syntax error at `foo' expecting IPv4 or IPv6 address. ct_dnat(); Syntax error at `)' expecting IPv4 or IPv6 address. +ct_dnat(192.168.1.2, foo); + Syntax error at `foo' expecting Integer for port range. +ct_dnat(192.168.1.2, 1000-foo); + Syntax error at `foo' expecting Integer for port range. +ct_dnat(192.168.1.2, 1000); + formats as ct_dnat(192.168.1.2,1000); + encodes as ct(commit,table=19,zone=NXM_NX_REG11[0..15],nat(dst=192.168.1.2:1000)) + has prereqs ip # ct_snat ct_snat; @@ -1069,15 +1081,27 @@ ct_snat(192.168.1.2); ct_snat(fd11::2); encodes as ct(commit,table=19,zone=NXM_NX_REG12[0..15],nat(src=fd11::2)) has prereqs ip +ct_snat(192.168.1.2, 1-3000); + formats as ct_snat(192.168.1.2,1-3000); + encodes as ct(commit,table=19,zone=NXM_NX_REG12[0..15],nat(src=192.168.1.2:1-3000)) + has prereqs ip ct_snat(192.168.1.2, 192.168.1.3); - Syntax error at `,' expecting `)'. + Syntax error at `192.168.1.3' expecting Integer for port range. ct_snat(foo); Syntax error at `foo' expecting IPv4 or IPv6 address. ct_snat(foo, bar); Syntax error at `foo' expecting IPv4 or IPv6 address. ct_snat(); Syntax error at `)' expecting IPv4 or IPv6 address. +ct_snat(192.168.1.2, foo); + Syntax error at `foo' expecting Integer for port range. +ct_snat(192.168.1.2, 1000-foo); + Syntax error at `foo' expecting Integer for port range. +ct_snat(192.168.1.2, 1000); + formats as ct_snat(192.168.1.2,1000); + encodes as ct(commit,table=19,zone=NXM_NX_REG12[0..15],nat(src=192.168.1.2:1000)) + has prereqs ip # ct_clear ct_clear;