summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2018-07-08 03:04:33 +0200
committerRenato Westphal <renato@opensourcerouting.org>2018-10-27 20:16:12 +0200
commita4bed468f9603da8199fdd828f5523c3b29ca15c (patch)
treee23e6d612e1a790fb0e109eed7b8e78cf63f926e
parentlib: add a new northbound plugin for Sysrepo (diff)
downloadfrr-a4bed468f9603da8199fdd828f5523c3b29ca15c.tar.xz
frr-a4bed468f9603da8199fdd828f5523c3b29ca15c.zip
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>
-rw-r--r--babeld/babel_main.c1
-rw-r--r--eigrpd/eigrp_main.c1
-rw-r--r--isisd/isis_main.c1
-rw-r--r--lib/if.c58
-rw-r--r--lib/if.h5
-rw-r--r--nhrpd/nhrp_main.c1
-rw-r--r--ospf6d/ospf6_main.c1
-rw-r--r--ospfd/ospf_main.c1
-rw-r--r--pbrd/pbr_main.c1
-rw-r--r--pimd/pim_main.c1
-rw-r--r--ripd/rip_main.c1
-rw-r--r--ripngd/ripng_main.c1
-rw-r--r--yang/frr-interface.yang46
-rw-r--r--yang/subdir.am1
-rw-r--r--zebra/main.c1
15 files changed, 120 insertions, 1 deletions
diff --git a/babeld/babel_main.c b/babeld/babel_main.c
index c92d46354..eaff97a49 100644
--- a/babeld/babel_main.c
+++ b/babeld/babel_main.c
@@ -138,6 +138,7 @@ struct option longopts[] =
static const struct frr_yang_module_info *babeld_yang_modules[] =
{
+ &frr_interface_info,
};
FRR_DAEMON_INFO(babeld, BABELD,
diff --git a/eigrpd/eigrp_main.c b/eigrpd/eigrp_main.c
index 3c0491fc5..063fc5fec 100644
--- a/eigrpd/eigrp_main.c
+++ b/eigrpd/eigrp_main.c
@@ -131,6 +131,7 @@ struct quagga_signal_t eigrp_signals[] = {
};
static const struct frr_yang_module_info *eigrpd_yang_modules[] = {
+ &frr_interface_info,
};
FRR_DAEMON_INFO(eigrpd, EIGRP, .vty_port = EIGRP_VTY_PORT,
diff --git a/isisd/isis_main.c b/isisd/isis_main.c
index bf0bd6ee6..c325a3d6f 100644
--- a/isisd/isis_main.c
+++ b/isisd/isis_main.c
@@ -151,6 +151,7 @@ struct quagga_signal_t isisd_signals[] = {
};
static const struct frr_yang_module_info *isisd_yang_modules[] = {
+ &frr_interface_info,
};
#ifdef FABRICD
diff --git a/lib/if.c b/lib/if.c
index e952313e8..6cf567855 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 bd5cc1770..24a86c764 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 */
diff --git a/nhrpd/nhrp_main.c b/nhrpd/nhrp_main.c
index e6ffa2f75..9b8599ede 100644
--- a/nhrpd/nhrp_main.c
+++ b/nhrpd/nhrp_main.c
@@ -117,6 +117,7 @@ static struct quagga_signal_t sighandlers[] = {
};
static const struct frr_yang_module_info *nhrpd_yang_modules[] = {
+ &frr_interface_info,
};
FRR_DAEMON_INFO(nhrpd, NHRP, .vty_port = NHRP_VTY_PORT,
diff --git a/ospf6d/ospf6_main.c b/ospf6d/ospf6_main.c
index 17dd334e0..046badc82 100644
--- a/ospf6d/ospf6_main.c
+++ b/ospf6d/ospf6_main.c
@@ -163,6 +163,7 @@ struct quagga_signal_t ospf6_signals[] = {
};
static const struct frr_yang_module_info *ospf6d_yang_modules[] = {
+ &frr_interface_info,
};
FRR_DAEMON_INFO(ospf6d, OSPF6, .vty_port = OSPF6_VTY_PORT,
diff --git a/ospfd/ospf_main.c b/ospfd/ospf_main.c
index 6085c91b9..36bb8d49b 100644
--- a/ospfd/ospf_main.c
+++ b/ospfd/ospf_main.c
@@ -124,6 +124,7 @@ struct quagga_signal_t ospf_signals[] = {
};
static const struct frr_yang_module_info *ospfd_yang_modules[] = {
+ &frr_interface_info,
};
FRR_DAEMON_INFO(ospfd, OSPF, .vty_port = OSPF_VTY_PORT,
diff --git a/pbrd/pbr_main.c b/pbrd/pbr_main.c
index f02cb5384..246d836ac 100644
--- a/pbrd/pbr_main.c
+++ b/pbrd/pbr_main.c
@@ -112,6 +112,7 @@ struct quagga_signal_t pbr_signals[] = {
#define PBR_VTY_PORT 2615
static const struct frr_yang_module_info *pbrd_yang_modules[] = {
+ &frr_interface_info,
};
FRR_DAEMON_INFO(pbrd, PBR, .vty_port = PBR_VTY_PORT,
diff --git a/pimd/pim_main.c b/pimd/pim_main.c
index 41c385e38..50ebc4003 100644
--- a/pimd/pim_main.c
+++ b/pimd/pim_main.c
@@ -72,6 +72,7 @@ struct zebra_privs_t pimd_privs = {
.cap_num_i = 0};
static const struct frr_yang_module_info *pimd_yang_modules[] = {
+ &frr_interface_info,
};
FRR_DAEMON_INFO(pimd, PIM, .vty_port = PIMD_VTY_PORT,
diff --git a/ripd/rip_main.c b/ripd/rip_main.c
index 79d1cca4a..b47b111bc 100644
--- a/ripd/rip_main.c
+++ b/ripd/rip_main.c
@@ -120,6 +120,7 @@ static struct quagga_signal_t ripd_signals[] = {
};
static const struct frr_yang_module_info *ripd_yang_modules[] = {
+ &frr_interface_info,
};
FRR_DAEMON_INFO(ripd, RIP, .vty_port = RIP_VTY_PORT,
diff --git a/ripngd/ripng_main.c b/ripngd/ripng_main.c
index d62df04ee..98df7ef12 100644
--- a/ripngd/ripng_main.c
+++ b/ripngd/ripng_main.c
@@ -119,6 +119,7 @@ struct quagga_signal_t ripng_signals[] = {
};
static const struct frr_yang_module_info *ripngd_yang_modules[] = {
+ &frr_interface_info,
};
FRR_DAEMON_INFO(ripngd, RIPNG, .vty_port = RIPNG_VTY_PORT,
diff --git a/yang/frr-interface.yang b/yang/frr-interface.yang
new file mode 100644
index 000000000..d3cc66dfa
--- /dev/null
+++ b/yang/frr-interface.yang
@@ -0,0 +1,46 @@
+module frr-interface {
+ yang-version 1.1;
+ namespace "http://frrouting.org/yang/interface";
+ prefix frr-interface;
+
+ organization
+ "Free Range Routing";
+ contact
+ "FRR Users List: <mailto:frog@lists.frrouting.org>
+ FRR Development List: <mailto:dev@lists.frrouting.org>";
+ description
+ "This module defines a model for managing FRR interfaces.";
+
+ revision 2018-03-28 {
+ description
+ "Initial revision.";
+ }
+
+ container lib {
+ list interface {
+ key "name vrf";
+ description
+ "Interface.";
+
+ leaf name {
+ type string {
+ length "1..16";
+ }
+ description
+ "Interface name.";
+ }
+ leaf vrf {
+ type string {
+ length "1..36";
+ }
+ description
+ "VRF this interface is associated with.";
+ }
+ leaf description {
+ type string;
+ description
+ "Interface description.";
+ }
+ }
+ }
+}
diff --git a/yang/subdir.am b/yang/subdir.am
index b290f9b27..8e9f83c3e 100644
--- a/yang/subdir.am
+++ b/yang/subdir.am
@@ -1 +1,2 @@
dist_yangmodels_DATA += yang/frr-module-translator.yang
+dist_yangmodels_DATA += yang/frr-interface.yang
diff --git a/zebra/main.c b/zebra/main.c
index 250ad902a..5d200b6da 100644
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -207,6 +207,7 @@ struct quagga_signal_t zebra_signals[] = {
};
static const struct frr_yang_module_info *zebra_yang_modules[] = {
+ &frr_interface_info,
};
FRR_DAEMON_INFO(