From: Ben Pfaff
With the benchmark at
https://mail.openvswitch.org/pipermail/ovs-dev/2021-July/385333.html,
this reduces memory consumption by 300 MB and elapsed time by a few
seconds.
Signed-off-by: Ben Pfaff
---
northd/ipam.dl | 2 +-
northd/lswitch.dl| 36 ++--
northd/multicast.dl | 2 +-
northd/ovn-nb.dlopts | 1 +
northd/ovn_northd.dl | 16
5 files changed, 29 insertions(+), 28 deletions(-)
diff --git a/northd/ipam.dl b/northd/ipam.dl
index da71b2872..4665a28cb 100644
--- a/northd/ipam.dl
+++ b/northd/ipam.dl
@@ -187,7 +187,7 @@ SwitchIPv4ReservedAddresses(lswitch, addrs) :-
var addrs = addr.group_by(lswitch).to_set().
SwitchIPv4ReservedAddresses(lswitch_uuid, set_empty()) :-
-nb::Logical_Switch(._uuid = lswitch_uuid),
+&nb::Logical_Switch(._uuid = lswitch_uuid),
not SwitchIPv4ReservedAddress(lswitch_uuid, _).
/* Allocate dynamic IP addresses for ports that require them:
diff --git a/northd/lswitch.dl b/northd/lswitch.dl
index 7e7b62a4d..868ae115f 100644
--- a/northd/lswitch.dl
+++ b/northd/lswitch.dl
@@ -44,7 +44,7 @@ SwitchRouterPeerRef(lsp, None) :-
* (Use LogicalSwitchPort instead, which guarantees uniqueness.) */
relation LogicalSwitchPortCandidate(lsp_uuid: uuid, ls_uuid: uuid)
LogicalSwitchPortCandidate(lsp_uuid, ls_uuid) :-
-nb::Logical_Switch(._uuid = ls_uuid, .ports = ports),
+&nb::Logical_Switch(._uuid = ls_uuid, .ports = ports),
var lsp_uuid = FlatMap(ports).
Warning[message] :-
LogicalSwitchPortCandidate(lsp_uuid, ls_uuid),
@@ -74,7 +74,7 @@ LogicalSwitchPortWithUnknownAddress(ls_uuid, lsp_uuid) :-
output relation LogicalSwitchHasUnknownPorts(ls: uuid, has_unknown: bool)
LogicalSwitchHasUnknownPorts(ls, true) :-
LogicalSwitchPortWithUnknownAddress(ls, _).
LogicalSwitchHasUnknownPorts(ls, false) :-
-nb::Logical_Switch(._uuid = ls),
+&nb::Logical_Switch(._uuid = ls),
not LogicalSwitchPortWithUnknownAddress(ls, _).
/* PortStaticAddresses: static IP addresses associated with each
Logical_Switch_Port */
@@ -101,11 +101,11 @@ PortInGroup(port, group) :-
relation LogicalSwitchACL(ls: uuid, acl: uuid)
LogicalSwitchACL(ls, acl) :-
-nb::Logical_Switch(._uuid = ls, .acls = acls),
+&nb::Logical_Switch(._uuid = ls, .acls = acls),
var acl = FlatMap(acls).
LogicalSwitchACL(ls, acl) :-
-nb::Logical_Switch(._uuid = ls, .ports = ports),
+&nb::Logical_Switch(._uuid = ls, .ports = ports),
var port_id = FlatMap(ports),
PortInGroup(port_id, group_id),
nb::Port_Group(._uuid = group_id, .acls = acls),
@@ -125,7 +125,7 @@ LogicalSwitchHasStatefulACL(ls, true) :-
LogicalSwitchStatefulACL(ls, _).
LogicalSwitchHasStatefulACL(ls, false) :-
-nb::Logical_Switch(._uuid = ls),
+&nb::Logical_Switch(._uuid = ls),
not LogicalSwitchStatefulACL(ls, _).
// "Pitfalls of projections" in ddlog-new-feature.rst explains why this
@@ -136,7 +136,7 @@ LogicalSwitchHasACLs(ls, true) :-
LogicalSwitchACL(ls, _).
LogicalSwitchHasACLs(ls, false) :-
-nb::Logical_Switch(._uuid = ls),
+&nb::Logical_Switch(._uuid = ls),
not LogicalSwitchACL(ls, _).
/*
@@ -146,7 +146,7 @@ LogicalSwitchHasACLs(ls, false) :-
*/
relation LogicalSwitchLocalnetPort0(ls_uuid: uuid, lsp: (uuid, string))
LogicalSwitchLocalnetPort0(ls_uuid, (lsp_uuid, lsp.name)) :-
-ls in nb::Logical_Switch(._uuid = ls_uuid),
+ls in &nb::Logical_Switch(._uuid = ls_uuid),
var lsp_uuid = FlatMap(ls.ports),
lsp in &nb::Logical_Switch_Port(._uuid = lsp_uuid),
lsp.__type == "localnet".
@@ -156,7 +156,7 @@ LogicalSwitchLocalnetPorts(ls_uuid, localnet_ports) :-
LogicalSwitchLocalnetPort0(ls_uuid, lsp),
var localnet_ports = lsp.group_by(ls_uuid).to_vec().
LogicalSwitchLocalnetPorts(ls_uuid, vec_empty()) :-
-ls in nb::Logical_Switch(),
+ls in &nb::Logical_Switch(),
var ls_uuid = ls._uuid,
not LogicalSwitchLocalnetPort0(ls_uuid, _).
@@ -164,7 +164,7 @@ LogicalSwitchLocalnetPorts(ls_uuid, vec_empty()) :-
relation LogicalSwitchDNS(ls_uuid: uuid, dns_uuid: uuid)
LogicalSwitchDNS(ls._uuid, dns_uuid) :-
-nb::Logical_Switch[ls],
+&nb::Logical_Switch[ls],
var dns_uuid = FlatMap(ls.dns_records),
nb::DNS(._uuid = dns_uuid).
@@ -183,12 +183,12 @@ LogicalSwitchHasDNSRecords(ls, true) :-
LogicalSwitchWithDNSRecords(ls).
LogicalSwitchHasDNSRecords(ls, false) :-
-nb::Logical_Switch(._uuid = ls),
+&nb::Logical_Switch(._uuid = ls),
not LogicalSwitchWithDNSRecords(ls).
relation LogicalSwitchHasNonRouterPort0(ls: uuid)
LogicalSwitchHasNonRouterPort0(ls_uuid) :-
-ls in nb::Logical_Switch(._uuid = ls_uuid),
+ls in &nb::Logical_Switch(._uuid = ls_uuid),
var lsp_uuid = FlatMap(ls.ports),
lsp in &nb::Logical_Switch_Port(._uuid = lsp_uuid),
lsp.__type != "router".
@@ -199,7 +199,7 @@ output relation LogicalSwitchHasNonRouterPort(ls: uuid,
has_non_router_port: boo
Log