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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
|
'use strict';
'require view';
'require form';
'require uci';
'require network';
'require tools.widgets as widgets';
return view.extend({
load: function() {
return Promise.all([
network.getDevices(),
uci.load('keepalived'),
]);
},
renderGeneralTab: function(s) {
var o, ipaddress;
o = s.taboption('general',form.Value, 'name', _('Name'));
o.rmempty = false;
o.optional = false;
o = s.taboption('general', form.ListValue, 'state', _('State'),
_('Initial State. As soon as the other machine(s) come up,') +
_('an election will be held and the machine with the highest "priority" will become MASTER.'));
o.value('MASTER', _('Master'));
o.value('BACKUP', _('Backup'));
o.optional = false;
o.rmempty = false;
o = s.taboption('general', widgets.DeviceSelect, 'interface', _('Interface'),
_('Interface for inside_network, bound by VRRP'));
o.noaliases = true;
o.noinactive = true;
o.optional = false;
o.rmempty = false;
o = s.taboption('general', form.Value, 'virtual_router_id', _('Virtual Router Id'),
_('Differentiate multiple instances of vrrpd, running on the same NIC'));
o.datatype = 'range(1-255)';
o.optional = false;
o.rmempty = false;
o = s.taboption('general', form.Value, 'priority', _('Priority'),
_('A server with a higher priority becomes a MASTER'));
o.datatype = 'uinteger';
o.optional = false;
o.rmempty = false;
o = s.taboption('general', form.ListValue, 'advert_int', _('Interval'),
_('VRRP Advert interval in seconds'));
o.datatype = 'float';
o.default = '1';
o.rmempty = false;
o.optional = false;
o.value('1');
o.value('3');
o.value('5');
o.value('10');
o.value('30');
o.value('60');
o = s.taboption('general', form.Flag, 'nopreempt', _('Disable Preempt'),
_('Allows the lower priority machine to maintain the master role,') +
_('even when a higher priority machine comes back online.') + ' ' +
_('For this to work, the initial state of this entry must be BACKUP.'));
o.optional = true;
o.default = false;
ipaddress = uci.sections('keepalived', 'ipaddress');
o = s.taboption('general', form.DynamicList, 'virtual_ipaddress', _('Virtual IP Address'),
_('Addresses add|del on change to MASTER, to BACKUP.') + ' ' +
_('With the same entries on other machines, the opposite transition will be occurring.'));
if (ipaddress != '') {
for (var i = 0; i < ipaddress.length; i++) {
o.value(ipaddress[i]['name']);
}
}
o.rmempty = false;
o.optional = false;
},
renderPeerTab: function(s, netDevs) {
var o;
o = s.taboption('peer', form.ListValue, 'unicast_src_ip', _('Unicast Source IP'),
_('Default IP for binding vrrpd is the primary IP on interface'));
o.datatype = 'ipaddr';
o.optional = true;
o.modalonly = true;
for (var i = 0; i < netDevs.length; i++) {
var addrs = netDevs[i].getIPAddrs();
for (var j = 0; j < addrs.length; j++) {
o.value(addrs[j].split('/')[0]);
}
}
var peers = uci.sections('keepalived', 'peer');
o = s.taboption('peer', form.DynamicList, 'unicast_peer', _('Peer'),
_('Do not send VRRP adverts over VRRP multicast group.') + ' ' +
_('Instead it sends adverts to the following list of ip addresses using unicast design fashion'));
if (peers != '') {
for (var i = 0; i < peers.length; i++) {
o.value(peers[i]['name']);
}
}
o = s.taboption('peer', form.Value, 'mcast_src_ip', _('Multicast Source IP'),
_('If you want to hide location of vrrpd, use this IP for multicast vrrp packets'));
o.datatype = 'ipaddr';
o.optional = true;
o.modalonly = true;
o.depends({ 'unicast_peer' : '' });
o = s.taboption('peer', form.ListValue, 'auth_type', _('HA Authentication Type'));
o.value('PASS', _('Simple Password'));
o.value('AH', _('IPSec'));
o = s.taboption('peer', form.Value, 'auth_pass', _('Password'),
_('Password for accessing vrrpd, should be the same on all machines'));
o.datatype = 'maxlength(8)';
o.password = true;
o.modalonly = true;
o.depends({ 'auth_type' : 'PASS' });
},
renderGARPTab: function(s) {
var o;
o = s.taboption('garp', form.ListValue, 'garp_master_delay', _('GARP Delay'),
_('Gratuitous Master Delay in seconds'));
o.datatype = 'uinteger';
o.modalonly = true;
o.value('1');
o.value('3');
o.value('5');
o.value('10');
o.value('30');
o.value('60');
o = s.taboption('garp', form.ListValue, 'garp_master_repeat', _('GARP Repeat'),
_('Gratuitous Master Repeat in seconds'));
o.datatype = 'uinteger';
o.modalonly = true;
o.value('1');
o.value('3');
o.value('5');
o.value('10');
o.value('30');
o.value('60');
o = s.taboption('garp', form.ListValue, 'garp_master_refresh', _('GARP Refresh'),
_('Gratuitous Master Refresh in seconds'));
o.datatype = 'uinteger';
o.modalonly = true;
o.value('1');
o.value('3');
o.value('5');
o.value('10');
o.value('30');
o.value('60');
o = s.taboption('garp', form.ListValue, 'garp_master_refresh_repeat', _('GARP Refresh Repeat'),
_('Gratuitous Master Refresh Repeat in seconds'));
o.datatype = 'uinteger';
o.modalonly = true;
o.value('1');
o.value('3');
o.value('5');
o.value('10');
o.value('30');
o.value('60');
},
renderAdvancedTab: function(s) {
var o;
o = s.taboption('advanced', form.Value, 'use_vmac', _('Use VMAC'),
_('Use VRRP Virtual MAC'));
o.optional = true;
o.placeholder = '[<VMAC_INTERFACE_NAME>] [MAC_ADDRESS]';
o.modalonly = true;
o = s.taboption('advanced', form.Flag, 'vmac_xmit_base', _('Use VMAC Base'),
_('Send/Recv VRRP messages from base interface instead of VMAC interfac'));
o.default = false;
o.optional = true;
o.modalonly = true;
o = s.taboption('advanced', form.Flag, 'native_ipv6', _('Use IPV6'),
_('Force instance to use IPv6'));
o.default = false;
o.optional = true;
o.modalonly = true;
o = s.taboption('advanced', form.Flag, 'dont_track_primary', _('Disable Primary Tracking'),
_('Ignore VRRP interface faults'));
o.default = false;
o.optional = true;
o.modalonly = true;
o = s.taboption('advanced', form.ListValue, 'version', _('Version'),
_('VRRP version to run on interface'));
o.value('', _('None'));
o.value('2', _('2'));
o.value('3', _('3'));
o.default = '';
o.modalonly = true;
o = s.taboption('advanced', form.Flag, 'accept', _('Accept'),
_('Accept packets to non address-owner'));
o.default = false;
o.optional = true;
o = s.taboption('advanced', form.Value, 'preempt_delay', _('Preempt Delay'),
_('Time in seconds to delay preempting compared'));
o.datatype = 'float';
o.placeholder = '300';
o.modalonly = true;
o = s.taboption('advanced', form.ListValue, 'debug', _('Debug'),
_('Debug Level'));
o.default = '0';
o.value('0');
o.value('1');
o.value('2');
o.value('3');
o.value('4');
o.modalonly = true;
o = s.taboption('advanced', form.Flag, 'smtp_alert', _('Email Alert'),
_('Send SMTP alerts'));
o.default = false;
o.modalonly = true;
},
renderTrackingTab: function(s) {
var o;
var ipaddress, routes, interfaces, scripts;
ipaddress = uci.sections('keepalived', 'ipaddress');
routes = uci.sections('keepalived', 'route');
interfaces = uci.sections('keepalived', 'track_interface');
scripts = uci.sections('keepalived', 'track_script');
o = s.taboption('tracking', form.DynamicList, 'virtual_ipaddress_excluded', _('Exclude Virtual IP Address'),
_('VRRP IP excluded from VRRP. For cases with large numbers (eg 200) of IPs on the same interface.') + ' ' +
_('To decrease the number of packets sent in adverts, you can exclude most IPs from adverts.'));
o.modalonly = true;
if (ipaddress != '') {
for (var i = 0; i < ipaddress.length; i++) {
o.value(ipaddress[i]['name']);
}
}
o = s.taboption('tracking', form.DynamicList, 'virtual_routes', _('Virtual Routes'),
_('Routes add|del when changing to MASTER, to BACKUP'));
o.modalonly = true;
if (routes != '') {
for (var i = 0; i < routes.length; i++) {
o.value(routes[i]['name']);
}
}
o = s.taboption('tracking', form.DynamicList, 'track_interface', _('Track Interfaces'),
_('Go to FAULT state if any of these go down'));
o.modalonly = true;
if (interfaces != '') {
for (var i = 0; i < interfaces.length; i++) {
o.value(interfaces[i]['name']);
}
}
o = s.taboption('tracking', form.DynamicList, 'track_script', _('Track Script'),
_('Go to FAULT state if any of these go down, if unweighted'));
o.modalonly = true;
if (scripts != '') {
for (var i = 0; i < scripts.length; i++) {
o.value(scripts[i]['name']);
}
}
},
render: function(data) {
var netDevs = data[0];
var m, s, o;
m = new form.Map('keepalived');
s = m.section(form.GridSection, 'vrrp_instance', _('VRRP Instance'),
_('Define an individual instance of the VRRP protocol running on an interface'));
s.anonymous = true;
s.addremove = true;
s.nodescriptions = true;
o = s.tab('general', _('General'));
o = s.tab('peer', _('Peer'));
o = s.tab('tracking', _('Tracking'));
o = s.tab('garp', _('GARP'));
o = s.tab('advanced', _('Advanced'));
this.renderGeneralTab(s);
this.renderPeerTab(s, netDevs);
this.renderTrackingTab(s);
this.renderGARPTab(s);
this.renderAdvancedTab(s);
return m.render();
}
});
|