1.. _lua:
2
3Lua
4===
5
6Lua is currently experimental within FRR and has very limited
7support.  If you would like to compile FRR with Lua you must
8follow these steps:
9
101. Installation of Relevant Libraries
11
12   .. code-block:: shell
13
14      apt-get install lua5.3 liblua5-3 liblua5.3-dev
15
16   These are the Debian libraries that are needed.  There should
17   be equivalent RPM's that can be found
18
192. Compilation
20
21   Configure needs these options
22
23   .. code-block:: shell
24
25      ./configure --enable-dev-build --enable-lua <all other interesting options>
26
27   Typically you just include the two new enable lines to build with it.
28
293. Using Lua
30
31   * Copy tools/lua.scr into /etc/frr
32
33   * Create a route-map match command
34
35   .. code-block:: console
36
37      !
38      router bgp 55
39        neighbor 10.50.11.116 remote-as external
40          address-family ipv4 unicast
41            neighbor 10.50.11.116 route-map TEST in
42          exit-address-family
43      !
44      route-map TEST permit 10
45        match command mooey
46      !
47
48   * In the lua.scr file make sure that you have a function named 'mooey'
49
50   .. code-block:: console
51
52      function mooey ()
53         zlog_debug(string.format("afi: %d: %s %d ifdx: %d aspath: %s localpref: %d",
54                    prefix.family, prefix.route, nexthop.metric,
55                    nexthop.ifindex, nexthop.aspath, nexthop.localpref))
56
57         nexthop.metric =  33
58         nexthop.localpref = 13
59         return 3
60      end
61
624. General Comments
63
64   Please be aware that this is extremely experimental and needs a ton of work
65   to get this up into a state that is usable.
66