cb85b60f16f7bab25024d3cfff842bbd51f740c8
[feed/routing.git] / bird-openwrt / bird6-openwrt / src / model / overview.lua
1 --[[
2 Copyright (C) 2014 - Eloi Carbó Solé (GSoC2014)
3 BGP/Bird integration with OpenWRT and QMP
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 ]]--
18
19 require("luci.sys")
20 local http = require "luci.http"
21 local uci = require "luci.model.uci"
22 local uciout = uci.cursor()
23
24 m=Map("bird6", "Bird6 UCI configuration helper", "")
25
26 -- Named section: "bird"
27
28 s_bird_uci = m:section(NamedSection, "bird", "bird", "Bird6 file settings", "")
29 s_bird_uci.addremove = False
30
31 uuc = s_bird_uci:option(Flag, "use_UCI_config", "Use UCI configuration", "Use UCI configuration instead of the /etc/bird6.conf file")
32
33 ucf = s_bird_uci:option(Value, "UCI_config_File", "UCI File", "Specify the file to place the UCI-translated configuration")
34 ucf.default = "/tmp/bird6.conf"
35
36 -- Named Section: "table"
37
38 s_bird_table = m:section(TypedSection, "table", "Tables configuration", "Configuration of the tables used in the protocols")
39 s_bird_table.addremove = true
40 s_bird_table.anonymous = true
41
42 name = s_bird_table:option(Value, "name", "Table name", "Descriptor ID of the table")
43
44 -- Named section: "global"
45
46 s_bird_global = m:section(NamedSection, "global", "global", "Global options", "Basic Bird6 settings")
47 s_bird_global.addremove = False
48
49 id = s_bird_global:option(Value, "router_id", "Router ID", "Identification number of the router. By default, is the router's IP.")
50
51 lf = s_bird_global:option(Value, "log_file", "Log File", "File used to store log related data.")
52
53 l = s_bird_global:option(MultiValue, "log", "Log", "Set which elements do you want to log.")
54 l:value("all", "All")
55 l:value("info", "Info")
56 l:value("warning","Warning")
57 l:value("error","Error")
58 l:value("fatal","Fatal")
59 l:value("debug","Debug")
60 l:value("trace","Trace")
61 l:value("remote","Remote")
62 l:value("auth","Auth")
63
64 d = s_bird_global:option(MultiValue, "debug", "Debug", "Set which elements do you want to debug.")
65 d:value("all", "All")
66 d:value("states","States")
67 d:value("routes","Routes")
68 d:value("filters","Filters")
69 d:value("interfaces","Interfaces")
70 d:value("events","Events")
71 d:value("packets","Packets")
72
73 listen_addr = s_bird_global:option(Value, "listen_bgp_addr", "BGP Address", "Set the Addres that BGP will listen to.")
74 listen_addr.optional = true
75
76 listen_port = s_bird_global:option(Value, "listen_bgp_port", "BGP Port", "Set the port that BGP will listen to.")
77 listen_port.optional = true
78
79 listen_dual = s_bird_global:option(Flag, "listen_bgp_dual", "BGP Dual/ipv6", "Set if BGP connections will listen ipv6 only 'ipv6only' or both ipv4/6 'dual' routes")
80 listen_dual.optional = true
81
82
83 function m.on_commit(self,map)
84 luci.sys.call('/etc/init.d/bird6 stop; /etc/init.d/bird6 start')
85 end
86
87 return m