]> git.puffer.fish Git - matthieu/frr.git/commitdiff
doc: Add some basic how-to for lua
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 12 Feb 2020 01:10:26 +0000 (20:10 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 14 Feb 2020 19:17:52 +0000 (14:17 -0500)
Add a couple breadcrumbs to get people up and running
with lua when they are trying to develop for it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
doc/developer/library.rst
doc/developer/lua.rst [new file with mode: 0644]
doc/developer/subdir.am

index a904a4e778b9afc42874c04e4580c5c498b1762c..3d5c6a2a15d444930f1c9477bbd4ce86c6ec35c7 100644 (file)
@@ -15,5 +15,6 @@ Library Facilities (libfrr)
    hooks
    cli
    modules
+   lua
 
 
diff --git a/doc/developer/lua.rst b/doc/developer/lua.rst
new file mode 100644 (file)
index 0000000..23eb35f
--- /dev/null
@@ -0,0 +1,65 @@
+.. _lua:
+
+Lua
+===
+
+Lua is currently experimental within FRR and has very limited
+support.  If you would like to compile FRR with Lua you must
+follow these steps:
+
+1. Installation of Relevant Libraries
+
+   .. code-block:: shell
+
+      apt-get install lua5.3 liblua5-3 liblua5.3-dev
+
+   These are the Debian libraries that are needed.  There should
+   be equivalent RPM's that can be found
+
+2. Compilation
+
+   Configure needs these options
+
+   .. code-block:: shell
+
+      ./configure --enable-dev-build --enable-lua <all other interesting options>
+
+   Typically you just include the two new enable lines to build with it.
+
+3. Using Lua
+
+   * Copy tools/lua.scr into /etc/frr
+
+   * Create a route-map match command
+
+   .. code-block:: console
+
+      !
+      router bgp 55
+        neighbor 10.50.11.116 remote-as external
+          address-family ipv4 unicast
+            neighbor 10.50.11.116 route-map TEST in
+          exit-address-family
+      !
+      route-map TEST permit 10
+        match command mooey
+      !
+
+   * In the lua.scr file make sure that you have a function named 'mooey'
+
+   .. code-block:: console
+
+      function mooey ()
+         zlog_debug(string.format("afi: %d: %s %d ifdx: %d aspath: %s localpref: %d",
+                    prefix.family, prefix.route, nexthop.metric,
+                    nexthop.ifindex, nexthop.aspath, nexthop.localpref))
+    
+         nexthop.metric =  33
+         nexthop.localpref = 13
+         return 3
+      end
+
+4. General Comments
+
+   Please be aware that this is extremely experimental and needs a ton of work
+   to get this up into a state that is usable.
index 791f7679a6ff98d211584acda9c35b75530d8c74..538a290c34ef9f832061e68dffff9720732ca817 100644 (file)
@@ -34,6 +34,7 @@ dev_RSTFILES = \
        doc/developer/lists.rst \
        doc/developer/locking.rst \
        doc/developer/logging.rst \
+       doc/developer/lua.rst \
        doc/developer/memtypes.rst \
        doc/developer/modules.rst \
        doc/developer/next-hop-tracking.rst \