summaryrefslogtreecommitdiff
path: root/doc/developer/lua.rst
blob: 3315c31ad7f1d8a712f2cec9ae7c029c3a1a282b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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.