applications/luci-olsr: Update CBI model for upstream compatibility with 0.5.6-rc7
[project/luci.git] / applications / luci-olsr / luasrc / model / cbi / olsr / olsrd.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2008 Steven Barth <steven@midlink.org>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13 ]]--
14 require("luci.fs")
15
16 m = Map("olsr", "OLSR")
17
18 s = m:section(NamedSection, "general", "olsr")
19
20 debug = s:option(ListValue, "DebugLevel")
21 for i=0, 9 do
22         debug:value(i)
23 end
24
25 ipv = s:option(ListValue, "IpVersion")
26 ipv:value("4", "IPv4")
27 ipv:value("6", "IPv6")
28
29 noint = s:option(Flag, "AllowNoInt")
30 noint.enabled = "yes"
31 noint.disabled = "no"
32
33 s:option(Value, "Pollrate")
34
35 tcr = s:option(ListValue, "TcRedundancy")
36 tcr:value("0", translate("olsr_general_tcredundancy_0"))
37 tcr:value("1", translate("olsr_general_tcredundancy_1"))
38 tcr:value("2", translate("olsr_general_tcredundancy_2"))
39
40 s:option(Value, "MprCoverage")
41
42 lql = s:option(ListValue, "LinkQualityLevel")
43 lql:value("0", translate("disable"))
44 lql:value("1", translate("olsr_general_linkqualitylevel_1"))
45 lql:value("2", translate("olsr_general_linkqualitylevel_2"))
46
47 s:option(Value, "LinkQualityAging").optional = true
48
49 lqa = s:option(ListValue, "LinkQualityAlgorithm")
50 lqa.optional = true
51 lqa:value("etx_fpm", translate("olsr_etx_fpm"))
52 lqa:value("etx_float", translate("olsr_etx_float"))
53 lqa:value("etx_ff", translate("olsr_etx_ff"))
54
55 lqfish = s:option(Flag, "LinkQualityFishEye")
56
57 s:option(Value, "LinkQualityWinSize")
58
59 s:option(Value, "LinkQualityDijkstraLimit")
60
61 hyst = s:option(Flag, "UseHysteresis")
62 hyst.enabled = "yes"
63 hyst.disabled = "no"
64
65 fib = s:option(ListValue, "FIBMetric")
66 fib.optional = true
67 fib:value("flat")
68 fib:value("correct")
69 fib:value("approx")
70
71 clrscr = s:option(Flag, "ClearScreen")
72 clrscr.enabled = "yes"
73 clrscr.disabled = "no"
74
75 willingness = s:option(ListValue, "Willingness")
76 for i=0,7 do
77         willingness:value(i)
78 end
79
80
81
82 i = m:section(TypedSection, "Interface", translate("interfaces"))
83 i.anonymous = true
84 i.addremove = true
85 i.dynamic = true
86
87 network = i:option(ListValue, "Interface", translate("network"))
88 network:value("")
89 luci.model.uci.foreach("network", "interface",
90         function (section)
91                 if section[".name"] ~= "loopback" then
92                         network:value(section[".name"])
93                 end
94         end)
95
96 i:option(Value, "Ip4Broadcast")
97 i:option(Value, "HelloInterval")
98 i:option(Value, "HelloValidityTime")
99 i:option(Value, "TcInterval")
100 i:option(Value, "TcValidityTime")
101 i:option(Value, "MidInterval")
102 i:option(Value, "MidValidityTime")
103 i:option(Value, "HnaInterval")
104 i:option(Value, "HnaValidityTime")
105
106
107 p = m:section(TypedSection, "LoadPlugin")
108 p.addremove = true
109 p.dynamic = true
110
111 lib = p:option(ListValue, "Library", translate("library"))
112 lib:value("")
113 for k, v in pairs(luci.fs.dir("/usr/lib")) do
114         if v:sub(1, 6) == "olsrd_" then
115                 lib:value(v)
116         end
117 end
118
119
120 for i, sect in ipairs({ "Hna4", "Hna6" }) do
121         hna = m:section(TypedSection, sect)
122         hna.addremove = true
123         hna.anonymous = true
124
125         net = hna:option(Value, "NetAddr")
126         msk = hna:option(Value, "Prefix")
127 end
128
129
130 ipc = m:section(NamedSection, "IpcConnect")
131 conns = ipc:option(Value, "MaxConnections")
132 conns.isInteger = true
133
134 nets  = ipc:option(Value, "Net")
135 nets.optional = true
136
137 hosts = ipc:option(Value, "Host")
138 hosts.optional = true
139
140
141 return m