File Coverage

lib/Net/ISC/DHCPd/OMAPI/Failover.pm
Criterion Covered Total %
statement 6 7 85.7
branch n/a
condition n/a
subroutine 2 3 66.6
pod 1 1 100.0
total 9 11 81.8


line stmt bran cond sub pod time code
1             package Net::ISC::DHCPd::OMAPI::Failover;
2              
3             =head1 NAME
4              
5             Net::ISC::DHCPd::OMAPI::Failover - OMAPI failover state class
6              
7             =head1 SEE ALSO
8              
9             L<Net::ISC::DHCPd::OMAPI::Actions>.
10             L<Net::ISC::DHCPd::OMAPI::Meta::Attribute>.
11              
12             =head1 SYNOPSIS
13              
14             use Net::ISC::DHCPd::OMAPI;
15              
16             $omapi = Net::ISC::DHCPd::OMAPI->new(...);
17             $omapi->connect
18             $failover = $omapi->new_object("failover", { $attr => $value });
19             $failover->$attr($value); # same as in constructor
20             $failover->read; # retrieve server information
21             $failover->write; # write to server
22              
23             =cut
24              
25 1     1   6 use Net::ISC::DHCPd::OMAPI::Sugar;
  1         3  
  1         13  
26 1     1   2038 use Moose;
  1         2  
  1         10  
27              
28             with 'Net::ISC::DHCPd::OMAPI::Actions';
29              
30             =head1 ATTRIBUTES
31              
32             =head2 name
33              
34             $self->name($name);
35             $str = $self->name;
36              
37             Indicates the name of the failover peer relationship, as described in
38             the server's dhcpd.conf file.
39              
40             Actions: examine.
41              
42             =cut
43              
44             omapi_attr name => (
45             isa => 'Str',
46             actions => [qw/examine/],
47             );
48              
49             =head2 partner_address
50              
51             $self->partner_address($str);
52             $str = $self->partner_address;
53              
54             Indicates the failover partner's IP address.
55              
56             Actions: examine.
57              
58             =head2 local_address
59              
60             $self->local_address($str);
61             $str = $self->local_address;
62              
63             Indicates the IP address that is being used by the DHCP server for this
64             failover pair.
65              
66             Actions: examine.
67              
68             =cut
69              
70             omapi_attr [qw/partner_address local_address/] => (
71             isa => Ip,
72             actions => [qw/examine/],
73             );
74              
75             =head2 partner_port
76              
77             $self->partner_port($int);
78             $int = $self->partner_port;
79              
80             Indicates the TCP port on which the failover partner is listening for
81             failover protocol connections.
82              
83             Actions: examine.
84              
85             =head2 local_port
86              
87             $self->local_port($int);
88             $int = $self->local_port;
89              
90             Indicates the TCP port on which the DHCP server is listening for failover
91             protocol connections for this failover pair.
92              
93             Actions: examine.
94              
95             =cut
96              
97             omapi_attr [qw/partner_port local_port/] => (
98             isa => 'Int',
99             actions => [qw/examine/],
100             );
101              
102             =head2 max_outstanding_updates
103              
104             $self->max_outstanding_updates($int);
105             $int = $self->max_outstanding_updates;
106              
107             Indicates the number of updates that can be outstanding and unacknowledged
108             at any given time, in this failover relationship.
109              
110             Actions: examine.
111              
112             =cut
113              
114             omapi_attr max_outstanding_updates => (
115             isa => Ip,
116             actions => [qw/examine/],
117             );
118              
119             =head2 mclt
120              
121             $self->mclt($int);
122             $int = $self->mclt;
123              
124             Indicates the maximum client lead time in this failover relationship.
125              
126             Actions: examine.
127              
128             =cut
129              
130             omapi_attr mclt => (
131             isa => 'Int',
132             actions => [qw/examine/],
133             );
134              
135             =head2 load_balance_mac_secs
136              
137             $self->load_balance_mac_secs($int);
138             $int = $self->load_balance_mac_secs;
139              
140             Indicates the maximum value for the secs field in a client request before
141             load balancing is bypassed.
142              
143             Actions: examine.
144              
145             =cut
146              
147             omapi_attr load_balance_mac_secs => (
148             isa => 'Int',
149             actions => [qw/examine/],
150             );
151              
152             =head2 load_balance_hba
153              
154             $self->load_balance_hba($str);
155             $str = $self->load_balance_hba;
156              
157             Indicates the load balancing hash bucket array for this failover relationship.
158              
159             Actions: examine.
160              
161             =cut
162              
163             omapi_attr load_balance_hba => (
164             isa => 'Str',
165             actions => [qw/examine/],
166             );
167              
168             =head2 local_state
169              
170             $self->local_state($int);
171             $self->local_state($str);
172             $str = $self->local_state;
173              
174             Indicates the present state of the DHCP server in this failover relationship.
175             Possible values for state are:
176              
177             1 - partner down
178             2 - normal
179             3 - communications interrupted
180             4 - resolution interrupted
181             5 - potential conflict
182             6 - recover
183             7 - recover done
184             8 - shutdown
185             9 - paused
186             10 - startup
187             11 - recover wait
188              
189             In general it is not a good idea to make changes to this state. However,
190             in the case that the failover partner is known to be down, it can be
191             useful to set the DHCP server's failover state to partner down. At this
192             point the DHCP server will take over service of the failover partner's
193             leases as soon as possible, and will give out normal leases, not leases
194             that are restricted by MCLT. If you do put the DHCP server into the
195             partner-down when the other DHCP server is not in the partner-down state,
196             but is not reachable, IP address assignment conflicts are possible, even
197             likely. Once a server has been put into partner-down mode, its failover
198             partner must not be brought back online until communication is possible
199             between the two servers.
200              
201             Actions: examine, modify.
202              
203             =cut
204              
205             omapi_attr local_state => (
206             isa => FailoverState,
207             actions => [qw/examine modify/],
208             );
209              
210             =head2 partner_state
211              
212             $self->partner_state($int);
213             $self->partner_state($str);
214             $str = $self->partner_state;
215              
216             Indicates the present state of the failover partner.
217              
218             Actions: examine.
219              
220             =cut
221              
222             omapi_attr partner_state => (
223             isa => FailoverState,
224             actions => [qw/examine/],
225             );
226              
227             =head2 local_stos
228              
229             $self->local_stos($int);
230             $int = $self->local_stos;
231              
232             Indicates the time at which the DHCP server entered its present state
233             in this failover relationship.
234              
235             Actions: examine.
236              
237             =head2 partner_stos
238              
239             $self->partner_stos($str);
240             $str = $self->partner_stos;
241              
242             Indicates the time at which the failover partner entered its present state.
243              
244             Actions: examine.
245              
246             =cut
247              
248             omapi_attr [qw/local_stos partner_stos/] => (
249             isa => Time,
250             actions => [qw/examine/],
251             );
252              
253             =head2 hierarchy
254              
255             $self->hierarchy($int);
256             $int = $self->hierarchy;
257              
258             Indicates whether the DHCP server is primary (0) or secondary (1)
259             in this failover relationship.
260              
261             Actions: examine.
262              
263             See L</is_primary>.
264              
265             =cut
266              
267             omapi_attr hierarchy => (
268             isa => 'Int',
269             actions => [qw/examine/],
270             );
271              
272             =head2 last_packet_sent
273              
274             $self->last_packet_sent($time);
275             $time = $self->last_packet_sent;
276              
277             Indicates the time at which the most recent failover packet was sent by
278             this DHCP server to its failover partner.
279              
280             Actions: examine.
281              
282             =cut
283              
284             omapi_attr last_packet_sent => (
285             isa => Time,
286             actions => [qw/examine/],
287             );
288              
289             =head2 last_timestamp_received
290              
291             $self->last_timestamp_received($str);
292             $str = $self->last_timestamp_received;
293              
294             Indicates the timestamp that was on the failover message most recently
295             received from the failover partner.
296              
297             Actions: examine.
298              
299             =cut
300              
301             omapi_attr last_timestamp_received => (
302             isa => Time,
303             actions => [qw/examine/],
304             );
305              
306             =head2 skew
307              
308             $self->skew($int);
309             $int = $self->skew;
310              
311             Indicates the skew between the failover partner's clock and this DHCP
312             server's clock
313              
314             Actions: examine.
315              
316             =cut
317              
318             omapi_attr skew => (
319             isa => 'Int',
320             actions => [qw/examine/],
321             );
322              
323             =head2 max_response_delay
324              
325             $self->max_response_delay($int);
326             $int = $self->max_response_delay;
327              
328             Indicates the time in seconds after which, if no message is received
329             from the failover partner, the partner is assumed to be out of communication.
330              
331             Actions: examine.
332              
333             =cut
334              
335             omapi_attr max_response_delay => (
336             isa => 'Int',
337             actions => [qw/examine/],
338             );
339              
340             =head2 cur_unacked_updates
341              
342             $self->cur_unacked_updates($int);
343             $int = $self->cur_unacked_updates;
344              
345             Indicates the number of update messages that have been received from
346             the failover partner but not yet processed.
347              
348             Actions: examine.
349              
350             =cut
351              
352             omapi_attr cur_unacked_updates => (
353             isa => 'Int',
354             actions => [qw/examine/],
355             );
356              
357             =head1 METHODS
358              
359             =head2 is_primary
360              
361             $bool = $self->is_primary;
362              
363             =cut
364              
365             sub is_primary {
366 0     0 1   confess "not implemented";
367             }
368              
369             =head1 ACKNOWLEDGEMENTS
370              
371             Most of the documentation is taken from C<dhcpd(8)>.
372              
373             =head1 COPYRIGHT & LICENSE
374              
375             =head1 AUTHOR
376              
377             See L<Net::ISC::DHCPd>.
378              
379             =cut
380             __PACKAGE__->meta->make_immutable;
381             1;