From patchwork Thu Apr 1 23:20:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1461447 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=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (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 4FBK3y13w0z9sV5 for ; Fri, 2 Apr 2021 10:23:10 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id A071941A41; Thu, 1 Apr 2021 23:23:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XPYV0xAubpJf; Thu, 1 Apr 2021 23:23:05 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTP id A18DC41A28; Thu, 1 Apr 2021 23:23:01 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 705C9C000B; Thu, 1 Apr 2021 23:23:01 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1E89FC000D for ; Thu, 1 Apr 2021 23:23:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 796CA40681 for ; Thu, 1 Apr 2021 23:21:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id a5gZS4nn4o_K for ; Thu, 1 Apr 2021 23:21:46 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by smtp2.osuosl.org (Postfix) with ESMTPS id C9A7A40623 for ; Thu, 1 Apr 2021 23:21:42 +0000 (UTC) X-Originating-IP: 75.54.222.30 Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id ED3A01C0005; Thu, 1 Apr 2021 23:21:39 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 1 Apr 2021 16:20:57 -0700 Message-Id: <20210401232108.3902274-16-blp@ovn.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210401232108.3902274-1-blp@ovn.org> References: <20210401232108.3902274-1-blp@ovn.org> MIME-Version: 1.0 Cc: Leonid Ryzhyk , Ben Pfaff Subject: [ovs-dev] [PATCH v2 15/26] ovn-northd-ddlog: Intern the Switch table. 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" From: Leonid Ryzhyk Change the type of record in the `Switch` table from `Ref` to `Intern`. Signed-off-by: Leonid Ryzhyk Signed-off-by: Ben Pfaff --- northd/lswitch.dl | 37 +++++++++++++++++++++---------------- northd/multicast.dl | 10 +++++----- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/northd/lswitch.dl b/northd/lswitch.dl index 47c497e0cff7..218272206e05 100644 --- a/northd/lswitch.dl +++ b/northd/lswitch.dl @@ -186,7 +186,7 @@ LogicalSwitchHasNonRouterPort(ls, false) :- /* Switch relation collects all attributes of a logical switch */ -relation &Switch( +typedef Switch = Switch { ls: nb::Logical_Switch, has_stateful_acl: bool, has_lb_vip: bool, @@ -200,7 +200,10 @@ relation &Switch( /* Does this switch have at least one port with type != "router"? */ has_non_router_port: bool -) +} + + +relation Switch[Intern] function ipv6_parse_prefix(s: string): Option { if (string_contains(s, "/")) { @@ -213,17 +216,19 @@ function ipv6_parse_prefix(s: string): Option { } } -&Switch(.ls = ls, - .has_stateful_acl = has_stateful_acl, - .has_lb_vip = has_lb_vip, - .has_dns_records = has_dns_records, - .has_unknown_ports = has_unknown_ports, - .localnet_ports = localnet_ports, - .subnet = subnet, - .ipv6_prefix = ipv6_prefix, - .mcast_cfg = mcast_cfg, - .has_non_router_port = has_non_router_port, - .is_vlan_transparent = is_vlan_transparent) :- +Switch[Switch{ + .ls = ls, + .has_stateful_acl = has_stateful_acl, + .has_lb_vip = has_lb_vip, + .has_dns_records = has_dns_records, + .has_unknown_ports = has_unknown_ports, + .localnet_ports = localnet_ports, + .subnet = subnet, + .ipv6_prefix = ipv6_prefix, + .mcast_cfg = mcast_cfg, + .has_non_router_port = has_non_router_port, + .is_vlan_transparent = is_vlan_transparent + }.intern()] :- nb::Logical_Switch[ls], LogicalSwitchHasStatefulACL(ls._uuid, has_stateful_acl), LogicalSwitchHasLBVIP(ls._uuid, has_lb_vip), @@ -449,7 +454,7 @@ SwitchPortDHCPv6Options(port, options) :- options in &DHCP_OptionsRef[nb::DHCP_Options{._uuid = dhcpv6_uuid}]. /* SwitchQoS: many-to-one relation between logical switches and nb::QoS */ -relation SwitchQoS(sw: Ref, qos: Ref) +relation SwitchQoS(sw: Intern, qos: Ref) SwitchQoS(sw, qos) :- sw in &Switch(.ls = nb::Logical_Switch{.qos_rules = qos_rules}), @@ -475,7 +480,7 @@ ACLWithFairMeter(acl, meter) :- meter in &MeterRef[nb::Meter{.name = meter_name, .fair = Some{true}}]. /* SwitchACL: many-to-many relation between logical switches and ACLs */ -relation &SwitchACL(sw: Ref, +relation &SwitchACL(sw: Intern, acl: Ref, has_fair_meter: bool) @@ -536,7 +541,7 @@ SwitchPortHAChassisGroup(lsp_uuid, None) :- relation &SwitchPort( lsp: nb::Logical_Switch_Port, json_name: string, - sw: Ref, + sw: Intern, peer: Option>, static_addresses: Vec, dynamic_address: Option, diff --git a/northd/multicast.dl b/northd/multicast.dl index 9b0fa80738d7..5a14a90da1cd 100644 --- a/northd/multicast.dl +++ b/northd/multicast.dl @@ -100,7 +100,7 @@ relation &McastPortCfg( /* Mapping between Switch and the set of router port uuids on which to flood * IP multicast for relay. */ -relation SwitchMcastFloodRelayPorts(sw: Ref, ports: Set) +relation SwitchMcastFloodRelayPorts(sw: Intern, ports: Set) SwitchMcastFloodRelayPorts(switch, relay_ports) :- &SwitchPort( @@ -124,7 +124,7 @@ SwitchMcastFloodRelayPorts(switch, set_empty()) :- /* Mapping between Switch and the set of port uuids on which to * flood IP multicast statically. */ -relation SwitchMcastFloodPorts(sw: Ref, ports: Set) +relation SwitchMcastFloodPorts(sw: Intern, ports: Set) SwitchMcastFloodPorts(switch, flood_ports) :- &SwitchPort( @@ -142,7 +142,7 @@ SwitchMcastFloodPorts(switch, set_empty()) :- /* Mapping between Switch and the set of port uuids on which to * flood IP multicast reports statically. */ -relation SwitchMcastFloodReportPorts(sw: Ref, ports: Set) +relation SwitchMcastFloodReportPorts(sw: Intern, ports: Set) SwitchMcastFloodReportPorts(switch, flood_ports) :- &SwitchPort( @@ -179,7 +179,7 @@ RouterMcastFloodPorts(router, set_empty()) :- /* Flattened IGMP group. One record per address-port tuple. */ relation IgmpSwitchGroupPort( address: string, - switch : Ref, + switch : Intern, port : uuid ) @@ -199,7 +199,7 @@ IgmpSwitchGroupPort(address, switch, localnet_port.0) :- */ relation IgmpSwitchMulticastGroup( address: string, - switch : Ref, + switch : Intern, ports : Set )