Add an additional node that initially does nothing. This serves as a
template for how to add a new node. This node is inserted between
the northd node and the database nodes.

This node will be updated in a later commit.

Signed-off-by: Mark Gray <[email protected]>
---
 northd/automake.mk       |   2 +
 northd/en-runtime.c      |  40 +++++++++++++
 northd/en-runtime.h      |  17 ++++++
 northd/inc-proc-northd.c | 120 ++++++++++++++++++++-------------------
 4 files changed, 121 insertions(+), 58 deletions(-)
 create mode 100644 northd/en-runtime.c
 create mode 100644 northd/en-runtime.h

diff --git a/northd/automake.mk b/northd/automake.mk
index f0c1fb11c83a..ea0658a6bc56 100644
--- a/northd/automake.mk
+++ b/northd/automake.mk
@@ -6,6 +6,8 @@ northd_ovn_northd_SOURCES = \
        northd/ovn-northd.c \
        northd/en-northd.c \
        northd/en-northd.h \
+       northd/en-runtime.c \
+       northd/en-runtime.h \
        northd/inc-proc-northd.c \
        northd/inc-proc-northd.h \
        northd/ipam.c \
diff --git a/northd/en-runtime.c b/northd/en-runtime.c
new file mode 100644
index 000000000000..aac01cd0351f
--- /dev/null
+++ b/northd/en-runtime.c
@@ -0,0 +1,40 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <config.h>
+
+#include <getopt.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "en-runtime.h"
+#include "lib/inc-proc-eng.h"
+#include "northd.h"
+#include "openvswitch/vlog.h"
+
+VLOG_DEFINE_THIS_MODULE(en_runtime);
+
+void en_runtime_run(struct engine_node *node, void *data OVS_UNUSED)
+{
+    engine_set_node_state(node, EN_UPDATED);
+}
+void *en_runtime_init(struct engine_node *node OVS_UNUSED,
+                     struct engine_arg *arg OVS_UNUSED)
+{
+    return NULL;
+}
+
+void en_runtime_cleanup(void *data OVS_UNUSED)
+{
+}
diff --git a/northd/en-runtime.h b/northd/en-runtime.h
new file mode 100644
index 000000000000..2547c9ec470a
--- /dev/null
+++ b/northd/en-runtime.h
@@ -0,0 +1,17 @@
+#ifndef EN_RUNTIME_H
+#define EN_RUNTIME_H 1
+
+#include <config.h>
+
+#include <getopt.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "lib/inc-proc-eng.h"
+
+void en_runtime_run(struct engine_node *node, void *data);
+void *en_runtime_init(struct engine_node *node,
+                      struct engine_arg *arg);
+void en_runtime_cleanup(void *data);
+
+#endif /* EN_RUNTIME_H */
diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c
index 243af43dda71..a885a68bdeb7 100644
--- a/northd/inc-proc-northd.c
+++ b/northd/inc-proc-northd.c
@@ -25,6 +25,7 @@
 #include "openvswitch/vlog.h"
 #include "inc-proc-northd.h"
 #include "en-northd.h"
+#include "en-runtime.h"
 #include "util.h"
 
 VLOG_DEFINE_THIS_MODULE(inc_proc_northd);
@@ -140,70 +141,73 @@ enum sb_engine_node {
 /* Define engine nodes for other nodes. They should be defined as static to
  * avoid sparse errors. */
 static ENGINE_NODE(northd, "northd");
+static ENGINE_NODE(runtime, "runtime");
 
 void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
                           struct ovsdb_idl_loop *sb)
 {
     /* Define relationships between nodes where first argument is dependent
      * on the second argument */
-    engine_add_input(&en_northd, &en_nb_nb_global, NULL);
-    engine_add_input(&en_northd, &en_nb_copp, NULL);
-    engine_add_input(&en_northd, &en_nb_logical_switch, NULL);
-    engine_add_input(&en_northd, &en_nb_logical_switch_port, NULL);
-    engine_add_input(&en_northd, &en_nb_forwarding_group, NULL);
-    engine_add_input(&en_northd, &en_nb_address_set, NULL);
-    engine_add_input(&en_northd, &en_nb_port_group, NULL);
-    engine_add_input(&en_northd, &en_nb_load_balancer, NULL);
-    engine_add_input(&en_northd, &en_nb_load_balancer_health_check, NULL);
-    engine_add_input(&en_northd, &en_nb_acl, NULL);
-    engine_add_input(&en_northd, &en_nb_logical_router, NULL);
-    engine_add_input(&en_northd, &en_nb_qos, NULL);
-    engine_add_input(&en_northd, &en_nb_meter, NULL);
-    engine_add_input(&en_northd, &en_nb_meter_band, NULL);
-    engine_add_input(&en_northd, &en_nb_logical_router_port, NULL);
-    engine_add_input(&en_northd, &en_nb_logical_router_static_route, NULL);
-    engine_add_input(&en_northd, &en_nb_logical_router_policy, NULL);
-    engine_add_input(&en_northd, &en_nb_nat, NULL);
-    engine_add_input(&en_northd, &en_nb_dhcp_options, NULL);
-    engine_add_input(&en_northd, &en_nb_connection, NULL);
-    engine_add_input(&en_northd, &en_nb_dns, NULL);
-    engine_add_input(&en_northd, &en_nb_ssl, NULL);
-    engine_add_input(&en_northd, &en_nb_gateway_chassis, NULL);
-    engine_add_input(&en_northd, &en_nb_ha_chassis_group, NULL);
-    engine_add_input(&en_northd, &en_nb_ha_chassis, NULL);
-    engine_add_input(&en_northd, &en_nb_bfd, NULL);
-
-    engine_add_input(&en_northd, &en_sb_sb_global, NULL);
-    engine_add_input(&en_northd, &en_sb_chassis, NULL);
-    engine_add_input(&en_northd, &en_sb_chassis_private, NULL);
-    engine_add_input(&en_northd, &en_sb_encap, NULL);
-    engine_add_input(&en_northd, &en_sb_address_set, NULL);
-    engine_add_input(&en_northd, &en_sb_port_group, NULL);
-    engine_add_input(&en_northd, &en_sb_logical_flow, NULL);
-    engine_add_input(&en_northd, &en_sb_logical_dp_group, NULL);
-    engine_add_input(&en_northd, &en_sb_multicast_group, NULL);
-    engine_add_input(&en_northd, &en_sb_meter, NULL);
-    engine_add_input(&en_northd, &en_sb_meter_band, NULL);
-    engine_add_input(&en_northd, &en_sb_datapath_binding, NULL);
-    engine_add_input(&en_northd, &en_sb_port_binding, NULL);
-    engine_add_input(&en_northd, &en_sb_mac_binding, NULL);
-    engine_add_input(&en_northd, &en_sb_dhcp_options, NULL);
-    engine_add_input(&en_northd, &en_sb_dhcpv6_options, NULL);
-    engine_add_input(&en_northd, &en_sb_connection, NULL);
-    engine_add_input(&en_northd, &en_sb_ssl, NULL);
-    engine_add_input(&en_northd, &en_sb_dns, NULL);
-    engine_add_input(&en_northd, &en_sb_rbac_role, NULL);
-    engine_add_input(&en_northd, &en_sb_rbac_permission, NULL);
-    engine_add_input(&en_northd, &en_sb_gateway_chassis, NULL);
-    engine_add_input(&en_northd, &en_sb_ha_chassis, NULL);
-    engine_add_input(&en_northd, &en_sb_ha_chassis_group, NULL);
-    engine_add_input(&en_northd, &en_sb_controller_event, NULL);
-    engine_add_input(&en_northd, &en_sb_ip_multicast, NULL);
-    engine_add_input(&en_northd, &en_sb_igmp_group, NULL);
-    engine_add_input(&en_northd, &en_sb_service_monitor, NULL);
-    engine_add_input(&en_northd, &en_sb_load_balancer, NULL);
-    engine_add_input(&en_northd, &en_sb_bfd, NULL);
-    engine_add_input(&en_northd, &en_sb_fdb, NULL);
+    engine_add_input(&en_runtime, &en_nb_nb_global, NULL);
+    engine_add_input(&en_runtime, &en_nb_copp, NULL);
+    engine_add_input(&en_runtime, &en_nb_logical_switch, NULL);
+    engine_add_input(&en_runtime, &en_nb_logical_switch_port, NULL);
+    engine_add_input(&en_runtime, &en_nb_forwarding_group, NULL);
+    engine_add_input(&en_runtime, &en_nb_address_set, NULL);
+    engine_add_input(&en_runtime, &en_nb_port_group, NULL);
+    engine_add_input(&en_runtime, &en_nb_load_balancer, NULL);
+    engine_add_input(&en_runtime, &en_nb_load_balancer_health_check, NULL);
+    engine_add_input(&en_runtime, &en_nb_acl, NULL);
+    engine_add_input(&en_runtime, &en_nb_logical_router, NULL);
+    engine_add_input(&en_runtime, &en_nb_qos, NULL);
+    engine_add_input(&en_runtime, &en_nb_meter, NULL);
+    engine_add_input(&en_runtime, &en_nb_meter_band, NULL);
+    engine_add_input(&en_runtime, &en_nb_logical_router_port, NULL);
+    engine_add_input(&en_runtime, &en_nb_logical_router_static_route, NULL);
+    engine_add_input(&en_runtime, &en_nb_logical_router_policy, NULL);
+    engine_add_input(&en_runtime, &en_nb_nat, NULL);
+    engine_add_input(&en_runtime, &en_nb_dhcp_options, NULL);
+    engine_add_input(&en_runtime, &en_nb_connection, NULL);
+    engine_add_input(&en_runtime, &en_nb_dns, NULL);
+    engine_add_input(&en_runtime, &en_nb_ssl, NULL);
+    engine_add_input(&en_runtime, &en_nb_gateway_chassis, NULL);
+    engine_add_input(&en_runtime, &en_nb_ha_chassis_group, NULL);
+    engine_add_input(&en_runtime, &en_nb_ha_chassis, NULL);
+    engine_add_input(&en_runtime, &en_nb_bfd, NULL);
+
+    engine_add_input(&en_runtime, &en_sb_sb_global, NULL);
+    engine_add_input(&en_runtime, &en_sb_chassis, NULL);
+    engine_add_input(&en_runtime, &en_sb_chassis_private, NULL);
+    engine_add_input(&en_runtime, &en_sb_encap, NULL);
+    engine_add_input(&en_runtime, &en_sb_address_set, NULL);
+    engine_add_input(&en_runtime, &en_sb_port_group, NULL);
+    engine_add_input(&en_runtime, &en_sb_logical_flow, NULL);
+    engine_add_input(&en_runtime, &en_sb_logical_dp_group, NULL);
+    engine_add_input(&en_runtime, &en_sb_multicast_group, NULL);
+    engine_add_input(&en_runtime, &en_sb_meter, NULL);
+    engine_add_input(&en_runtime, &en_sb_meter_band, NULL);
+    engine_add_input(&en_runtime, &en_sb_datapath_binding, NULL);
+    engine_add_input(&en_runtime, &en_sb_port_binding, NULL);
+    engine_add_input(&en_runtime, &en_sb_mac_binding, NULL);
+    engine_add_input(&en_runtime, &en_sb_dhcp_options, NULL);
+    engine_add_input(&en_runtime, &en_sb_dhcpv6_options, NULL);
+    engine_add_input(&en_runtime, &en_sb_connection, NULL);
+    engine_add_input(&en_runtime, &en_sb_ssl, NULL);
+    engine_add_input(&en_runtime, &en_sb_dns, NULL);
+    engine_add_input(&en_runtime, &en_sb_rbac_role, NULL);
+    engine_add_input(&en_runtime, &en_sb_rbac_permission, NULL);
+    engine_add_input(&en_runtime, &en_sb_gateway_chassis, NULL);
+    engine_add_input(&en_runtime, &en_sb_ha_chassis, NULL);
+    engine_add_input(&en_runtime, &en_sb_ha_chassis_group, NULL);
+    engine_add_input(&en_runtime, &en_sb_controller_event, NULL);
+    engine_add_input(&en_runtime, &en_sb_ip_multicast, NULL);
+    engine_add_input(&en_runtime, &en_sb_igmp_group, NULL);
+    engine_add_input(&en_runtime, &en_sb_service_monitor, NULL);
+    engine_add_input(&en_runtime, &en_sb_load_balancer, NULL);
+    engine_add_input(&en_runtime, &en_sb_bfd, NULL);
+    engine_add_input(&en_runtime, &en_sb_fdb, NULL);
+
+    engine_add_input(&en_northd, &en_runtime, NULL);
 
     struct engine_arg engine_arg = {
         .nb_idl = nb->idl,
-- 
2.27.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to