]> git.proxmox.com Git - mirror_frr.git/commitdiff
yang, lib: add 'frr-interface.yang' and associated stub callbacks
authorRenato Westphal <renato@opensourcerouting.org>
Sun, 8 Jul 2018 01:04:33 +0000 (22:04 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Sat, 27 Oct 2018 18:16:12 +0000 (16:16 -0200)
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>
15 files changed:
babeld/babel_main.c
eigrpd/eigrp_main.c
isisd/isis_main.c
lib/if.c
lib/if.h
nhrpd/nhrp_main.c
ospf6d/ospf6_main.c
ospfd/ospf_main.c
pbrd/pbr_main.c
pimd/pim_main.c
ripd/rip_main.c
ripngd/ripng_main.c
yang/frr-interface.yang [new file with mode: 0644]
yang/subdir.am
zebra/main.c

index c92d4635472c99ee52d0f35d03c176d923dfbbbc..eaff97a49565a59644eeaee58f5141f10a944e0c 100644 (file)
@@ -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,
index 3c0491fc52542d7ba95f3a686d9a20c7e962440e..063fc5fec10dc61366e4ece1692921b32dc95005 100644 (file)
@@ -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,
index bf0bd6ee6b1656c94f78a277e3eca3253303fbd5..c325a3d6fe9c34c5fedeab77ff2da8d828826cce 100644 (file)
@@ -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
index e952313e8eeb2238f43f070ffb76d2e010fe0055..6cf567855428eb50a984751404cf80d647794384 100644 (file)
--- 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,
+               },
+       }
+};
index bd5cc17704c3bf697a8649f01bf54deaff7a4b28..24a86c764263890d6904f930ed2c3451e80763bb 100644 (file)
--- 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 */
index e6ffa2f75dc6fe8ba93d7d63488a59c6a710c853..9b8599eded575dbce3184b67ab8d00874f0d668f 100644 (file)
@@ -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,
index 17dd334e0713551f226d1f1567515f9529bf2466..046badc8248504b40847bd17787d236275fcf61a 100644 (file)
@@ -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,
index 6085c91b9ab7b825c3ebfe088f729d0a4d0b5a53..36bb8d49b595caefd3c4c3af2fbad29482a7a0c2 100644 (file)
@@ -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,
index f02cb538491b9a4e4ea1f5f9fe755781e8c1ea40..246d836acf2e05271bac21d80ca15c8dfbdb6dca 100644 (file)
@@ -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,
index 41c385e3885ccfc4d86dc7f80b86088c3c6c4f34..50ebc4003ec97554c26e31f2b83b39490c55bde9 100644 (file)
@@ -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,
index 79d1cca4a184cc0f7cdb07c4a34fed3fc6eafad6..b47b111bc9cdf90595eac85342e4e547d58e5254 100644 (file)
@@ -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,
index d62df04ee06349efa45bb9c1eec53b41f274bbe5..98df7ef12d89111708b456b7a8fa8d2905d55e3c 100644 (file)
@@ -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 (file)
index 0000000..d3cc66d
--- /dev/null
@@ -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.";
+      }
+    }
+  }
+}
index b290f9b278eba2f55651a7a1aed478fbb42c81a5..8e9f83c3e596411ba36f40209b9316aa820f5333 100644 (file)
@@ -1 +1,2 @@
 dist_yangmodels_DATA += yang/frr-module-translator.yang
+dist_yangmodels_DATA += yang/frr-interface.yang
index 250ad902a8d60be6dde2d511058db3131920b3a2..5d200b6da98232aa8f1adc1baad2599df2c8232c 100644 (file)
@@ -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(