summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2018-07-07 22:04:33 -0300
committerRenato Westphal <renato@opensourcerouting.org>2018-10-27 16:16:12 -0200
commita4bed468f9603da8199fdd828f5523c3b29ca15c (patch)
treee23e6d612e1a790fb0e109eed7b8e78cf63f926e /lib
parenta7ca2199b709e268196878554e01c9e78bc1c60f (diff)
yang, lib: add 'frr-interface.yang' and associated stub callbacks
Introduce frr-interface.yang, which defines a model for managing FRR interfaces. Update the 'frr_yang_module_info' array of all daemons that will implement this module. Add automatically generated stub callbacks in if.c. These callbacks will be implemented in the following commit. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/if.c58
-rw-r--r--lib/if.h5
2 files changed, 62 insertions, 1 deletions
diff --git a/lib/if.c b/lib/if.c
index e952313e8e..6cf5678554 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -1211,3 +1211,61 @@ void if_link_params_free(struct interface *ifp)
XFREE(MTYPE_IF_LINK_PARAMS, ifp->link_params);
ifp->link_params = NULL;
}
+
+/* ------- Northbound callbacks ------- */
+
+/*
+ * XPath: /frr-interface:lib/interface
+ */
+static int lib_interface_create(enum nb_event event,
+ const struct lyd_node *dnode,
+ union nb_resource *resource)
+{
+ /* TODO: implement me. */
+ return NB_OK;
+}
+
+static int lib_interface_delete(enum nb_event event,
+ const struct lyd_node *dnode)
+{
+ /* TODO: implement me. */
+ return NB_OK;
+}
+
+/*
+ * XPath: /frr-interface:lib/interface/description
+ */
+static int lib_interface_description_modify(enum nb_event event,
+ const struct lyd_node *dnode,
+ union nb_resource *resource)
+{
+ /* TODO: implement me. */
+ return NB_OK;
+}
+
+static int lib_interface_description_delete(enum nb_event event,
+ const struct lyd_node *dnode)
+{
+ /* TODO: implement me. */
+ return NB_OK;
+}
+
+/* clang-format off */
+const struct frr_yang_module_info frr_interface_info = {
+ .name = "frr-interface",
+ .nodes = {
+ {
+ .xpath = "/frr-interface:lib/interface",
+ .cbs.create = lib_interface_create,
+ .cbs.delete = lib_interface_delete,
+ },
+ {
+ .xpath = "/frr-interface:lib/interface/description",
+ .cbs.modify = lib_interface_description_modify,
+ .cbs.delete = lib_interface_description_delete,
+ },
+ {
+ .xpath = NULL,
+ },
+ }
+};
diff --git a/lib/if.h b/lib/if.h
index bd5cc17704..24a86c7642 100644
--- a/lib/if.h
+++ b/lib/if.h
@@ -497,7 +497,6 @@ extern bool if_is_loopback_or_vrf(struct interface *ifp);
extern int if_is_broadcast(struct interface *);
extern int if_is_pointopoint(struct interface *);
extern int if_is_multicast(struct interface *);
-extern void if_cmd_init(void);
struct vrf;
extern void if_terminate(struct vrf *vrf);
extern void if_dump_all(void);
@@ -534,4 +533,8 @@ struct nbr_connected *nbr_connected_check(struct interface *, struct prefix *);
struct if_link_params *if_link_params_get(struct interface *);
void if_link_params_free(struct interface *);
+/* Northbound. */
+extern void if_cmd_init(void);
+extern const struct frr_yang_module_info frr_interface_info;
+
#endif /* _ZEBRA_IF_H */