blib/lib/BigIP/iControl.pm

filter: Statementstmt 6.2% 28 / 446 Branchbran 0.0% 0 / 72 Conditioncond 0.0% 0 / 31 MC/DCmcdc 0.0% 0 / 20 Subroutinesub 6.0% 8 / 132 Podpod 100% 104 / 104 totaltotal 17.3% 140 / 805 CC 63 SCAR 31.3
CC
63
Cov
5%
_request
182.0
create_subscription_list
90.0
new
42.0
CRAP 22.9
↑ Summary
1 package BigIP::iControl;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use Carp qw(confess croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use SOAP::Lite;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use MIME::Base64;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use Math::BigInt;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 2 our $VERSION = '0.098';
13  
14 =head1 NAME
15  
16 BigIP::iControl - A Perl interface to the F5 iControl API
17  
18 =head1 SYNOPSIS
19  
20 use BigIP::iControl;
21  
22 my $ic = BigIP::iControl->new(
23 server => 'bigip.company.com',
24 username => 'api_user',
25 password => 'my_password',
26 port => 443,
27 proto => 'https'
28 );
29  
30 my $virtual = ($ic->get_vs_list())[0];
31  
32 my %stats = $ic->get_vs_statistics_stringified($virtual);;
33  
34 print '*'x50,"\nVirtual: $virtual\n",'*'x50,"\nTimestamp: $stats{timestamp}\n";
35  
36 foreach my $s (sort keys %{$stats{stats}}) {
37 print "$s\t$stats{stats}{$s}\n"
38 }
39  
40 =head1 DESCRIPTION
41  
42 This package provides a Perl interface to the F5 BigIP iControl API.
43  
44 The F5 BigIP iControl API is an open SOAP/XML for communicating with supported F5 BigIP products.
45  
46 The primary aim of this package is to provide a simplified interface to an already simple and
47 intutive API and to allow the user to do more with less code. By reducing the API invocations
48 to methods returning simple types, it is hoped that this module will provide a simple alternative
49 for common tasks.
50  
51 The secondary aim for this package is to provide a simple interface for accessing statistical
52 data from the iControl API for monitoring, recording, archival and display in other systems.
53 This objective has largely been obsoleted in v11 with the introduction of new statistical
54 monitoring and display features in the web UI.
55  
56 This package generally provides two methods for each each task; a raw method typically returning
57 the response as received from iControl, and a "stringified" method returning a parsed response.
58  
59 In general, the stringified methods will typically fufill most requirements and should usually
60 be easier to use.
61  
62 =cut
63  
64 2 our $urn_map;
65  
66 # Our implementation of the iControl API
67 # Refer to http://devcentral.f5.com/wiki/iControl.APIReference.ashx for complete detail.
68  
69 2 our $modules = {
70 ARX => {},
71 ASM => {},
72 Common => {},
73 GlobalLB => {
74 Pool => {
75 get_description => 'pool_names',
76 get_list => 0,
77 get_member => 'pool_names'
78 },
79 VirtualServer => {
80 get_all_statistics => 0,
81 get_enabled_state => 'virtual_servers',
82 get_list => 0
83 }
84 },
85 LTConfig => {},
86 LocalLB => {
87 VirtualServer => {
88 get_list => 0,
89 get_default_pool_name => 'virtual_servers',
90 get_destination => 'virtual_servers',
91 get_enabled_state => 'virtual_servers',
92 get_protocol => 'virtual_servers',
93 get_statistics => 'virtual_servers',
94 get_all_statistics => 0,
95 get_rule => 'virtual_servers',
96 get_snat_pool => 'virtual_servers',
97 get_snat_type => 'virtual_servers'
98 },
99 Pool => {
100 get_list => 0,
101 get_member => 'pool_names',
102 get_object_status => 'pool_names',
103 get_statistics => 'pool_names',
104 get_all_statistics => 'pool_names',
105 get_member_object_status=> {pool_names => 1, members => 1}
106 },
107 PoolMember => {
108 get_object_status => 'pool_names',
109 get_statistics => {pool_names => 1, members => 1},
110 get_all_statistics => 'pool_names',
111 },
112 NodeAddress => {
113 get_list => 0,
114 get_screen_name => 'node_addresses',
115 get_object_status => 'node_addresses',
116 get_monitor_status => 'node_addresses',
117 get_statistics => 'node_addresses'
118 },
119 Class => {
120 get_address_class_list => 0,
121 get_string_class_list => 0,
122 get_string_class => 'class_names',
123 get_string_class_member_data_value => 'class_members',
124 set_string_class_member_data_value => {class_members => 1, values => 1},
125 add_string_class_member => 'class_members',
126 delete_string_class_member=> 'class_members',
127 }
128 },
129 Management => {
130 DBVariable => {
131 query => 'variables'
132 },
133 EventSubscription=> {
134 create => 'sub_detail_list',
135 get_list => 0,
136 get_authentication => 'id_list',
137 get_state => 'id_list',
138 get_url => 'id_list',
139 get_proxy_url => 'id_list',
140 remove => 'id_list',
141 query => 'id_list'
142 }
143 },
144 Networking => {
145 Interfaces => {
146 get_list => 0,
147 get_enabled_state => {interfaces => 1},
148 get_media_speed => {interfaces => 1},
149 get_media_status => {interfaces => 1},
150 get_statistics => {interfaces => 1}
151 },
152 SelfIP => {
153 get_list => 0,
154 get_vlan => {self_ips => 1}
155 },
156 Trunk => {
157 get_interface => {trunks => 1},
158 get_lacp_enabled_state => {trunks => 1},
159 get_active_lacp_state => {trunks => 1},
160 get_list => 0,
161 get_configured_member_count=> {trunks => 1},
162 get_operational_member_count=> {trunks => 1},
163 get_media_speed => {trunks => 1},
164 get_media_status => {trunks => 1},
165 get_statistics => {trunks => 1}
166 }
167 },
168 System => {
169 ConfigSync => {
170 get_configuration_list => 0,
171 delete_configuration => {filename => 1},
172 save_configuration => {filename => 1, save_flag => 1},
173 download_file => {file_name => 1, chunk_size => 1, file_offset => 1},
174 download_configuration => {config_name => 1, chunk_size => 1, file_offset => 1}
175 },
176 SystemInfo => {
177 get_system_information => 0,
178 get_system_id => 0,
179 get_cpu_metrics => 0,
180 get_cpu_usage_extended_information=> 'host_ids'
181 },
182 Cluster => {
183 get_cluster_enabled_state=> 'cluster_names',
184 get_list => 0
185 },
186 Failover => {
187 get_failover_mode => 0,
188 get_failover_state => 0,
189 is_redundant => 0
190 },
191 Connections => {
192 get_list => 0,
193 get_all_active_connections=>0
194 },
195 Services => {
196 get_list => 0,
197 get_service_status => {services => 1},
198 get_all_service_statuses=> 0
199 }
200 },
201 WebAccelerator => {}
202 };
203  
204 2 our $event_types= {
205 EVENTTYPE_NONE => 1,
206 EVENTTYPE_TEST => 1,
207 EVENTTYPE_ALL => 1,
208 EVENTTYPE_SYSTEM_STARTUP => 1,
209 EVENTTYPE_SYSTEM_SHUTDOWN => 1,
210 EVENTTYPE_SYSTEM_CONFIG_LOAD => 1,
211 EVENTTYPE_CREATE => 1,
212 EVENTTYPE_MODIFY => 1,
213 EVENTTYPE_DELETE => 1,
214 EVENTTYPE_ADMIN_IP => 1,
215 EVENTTYPE_ARP_ENTRY => 1,
216 EVENTTYPE_DAEMON_HA => 1,
217 EVENTTYPE_DB_VARIABLE => 1,
218 EVENTTYPE_FEATURE_FLAGS => 1,
219 EVENTTYPE_FILTER_PROFILE => 1,
220 EVENTTYPE_GTMD => 1,
221 EVENTTYPE_INTERFACE => 1,
222 EVENTTYPE_LCDWARN => 1,
223 EVENTTYPE_L2_FORWARD => 1,
224 EVENTTYPE_MIRROR_PORT_MEMBER => 1,
225 EVENTTYPE_MIRROR_PORT => 1,
226 EVENTTYPE_MIRROR_VLAN => 1,
227 EVENTTYPE_MONITOR => 1,
228 EVENTTYPE_NAT => 1,
229 EVENTTYPE_NODE_ADDRESS => 1,
230 EVENTTYPE_PACKET_FILTER => 1,
231 EVENTTYPE_PCI_DEVICE => 1,
232 EVENTTYPE_POOL => 1,
233 EVENTTYPE_POOL_MEMBER => 1,
234 EVENTTYPE_RATE_FILTER => 1,
235 EVENTTYPE_ROUTE_MGMT => 1,
236 EVENTTYPE_ROUTE_UPDATE => 1,
237 EVENTTYPE_RULE => 1,
238 EVENTTYPE_SELF_IP => 1,
239 EVENTTYPE_SENSOR => 1,
240 EVENTTYPE_SNAT_ADDRESS => 1,
241 EVENTTYPE_SNAT_POOL => 1,
242 EVENTTYPE_SNAT_POOL_MEMBER => 1,
243 EVENTTYPE_STP => 1,
244 EVENTTYPE_SWITCH_DOMAIN => 1,
245 EVENTTYPE_SWITCH_EDGE => 1,
246 EVENTTYPE_TAMD_AUTH => 1,
247 EVENTTYPE_TRUNK => 1,
248 EVENTTYPE_TRUNK_CONFIG_MEMBER => 1,
249 EVENTTYPE_TRUNK_WORKING_MEMBER => 1,
250 EVENTTYPE_VALUE_LIST => 1,
251 EVENTTYPE_VIRTUAL_ADDRESS => 1,
252 EVENTTYPE_VIRTUAL_SERVER => 1,
253 EVENTTYPE_VIRTUAL_SERVER_PROFILE=> 1,
254 EVENTTYPE_VLAN => 1,
255 EVENTTYPE_VLAN_MEMBER => 1,
256 EVENTTYPE_VLANGROUP => 1
257 };
258  
259  
260 2 ▶sub BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
261  
262 2 $urn_map= {
263 '{urn:iControl}ASM.ApplyLearningType' => 1,
264 '{urn:iControl}ASM.DynamicSessionsInUrlType' => 1,
265 '{urn:iControl}ASM.FlagState' => 1,
266 '{urn:iControl}ASM.PolicyTemplate' => 1,
267 '{urn:iControl}ASM.ProtocolType' => 1,
268 '{urn:iControl}ASM.SeverityName' => 1,
269 '{urn:iControl}ASM.ViolationName' => 1,
270 '{urn:iControl}ASM.WebApplicationLanguage' => 1,
271 '{urn:iControl}Common.ArmedState' => 1,
272 '{urn:iControl}Common.AuthenticationMethod' => 1,
273 '{urn:iControl}Common.AvailabilityStatus' => 1,
274 '{urn:iControl}Common.DaemonStatus' => 1,
275 '{urn:iControl}Common.EnabledState' => 1,
276 '{urn:iControl}Common.EnabledStatus' => 1,
277 '{urn:iControl}Common.FileChainType' => 1,
278 '{urn:iControl}Common.HAAction' => 1,
279 '{urn:iControl}Common.HAState' => 1,
280 '{urn:iControl}Common.IPHostType' => 1,
281 '{urn:iControl}Common.ProtocolType' => 1,
282 '{urn:iControl}Common.SourcePortBehavior' => 1,
283 '{urn:iControl}Common.StatisticType' => 1,
284 '{urn:iControl}Common.TMOSModule' => 1,
285 '{urn:iControl}GlobalLB.AddressType' => 1,
286 '{urn:iControl}GlobalLB.AutoConfigurationState' => 1,
287 '{urn:iControl}GlobalLB.AvailabilityDependency' => 1,
288 '{urn:iControl}GlobalLB.LBMethod' => 1,
289 '{urn:iControl}GlobalLB.LDNSProbeProtocol' => 1,
290 '{urn:iControl}GlobalLB.LinkWeightType' => 1,
291 '{urn:iControl}GlobalLB.MetricLimitType' => 1,
292 '{urn:iControl}GlobalLB.MonitorAssociationRemovalRule' => 1,
293 '{urn:iControl}GlobalLB.MonitorInstanceStateType' => 1,
294 '{urn:iControl}GlobalLB.MonitorRuleType' => 1,
295 '{urn:iControl}GlobalLB.RegionDBType' => 1,
296 '{urn:iControl}GlobalLB.RegionType' => 1,
297 '{urn:iControl}GlobalLB.ServerType' => 1,
298 '{urn:iControl}GlobalLB.Application.ApplicationObjectType' => 1,
299 '{urn:iControl}GlobalLB.DNSSECKey.KeyAlgorithm' => 1,
300 '{urn:iControl}GlobalLB.DNSSECKey.KeyType' => 1,
301 '{urn:iControl}GlobalLB.Monitor.IntPropertyType' => 1,
302 '{urn:iControl}GlobalLB.Monitor.StrPropertyType' => 1,
303 '{urn:iControl}GlobalLB.Monitor.TemplateType' => 1,
304 '{urn:iControl}LocalLB.AddressType' => 1,
305 '{urn:iControl}LocalLB.AuthenticationMethod' => 1,
306 '{urn:iControl}LocalLB.AvailabilityStatus' => 1,
307 '{urn:iControl}LocalLB.ClientSSLCertificateMode' => 1,
308 '{urn:iControl}LocalLB.ClonePoolType' => 1,
309 '{urn:iControl}LocalLB.CompressionMethod' => 1,
310 '{urn:iControl}LocalLB.CookiePersistenceMethod' => 1,
311 '{urn:iControl}LocalLB.CredentialSource' => 1,
312 '{urn:iControl}LocalLB.EnabledStatus' => 1,
313 '{urn:iControl}LocalLB.HardwareAccelerationMode' => 1,
314 '{urn:iControl}LocalLB.HttpChunkMode' => 1,
315 '{urn:iControl}LocalLB.HttpCompressionMode' => 1,
316 '{urn:iControl}LocalLB.HttpRedirectRewriteMode' => 1,
317 '{urn:iControl}LocalLB.LBMethod' => 1,
318 '{urn:iControl}LocalLB.MonitorAssociationRemovalRule' => 1,
319 '{urn:iControl}LocalLB.MonitorInstanceStateType' => 1,
320 '{urn:iControl}LocalLB.MonitorRuleType' => 1,
321 '{urn:iControl}LocalLB.MonitorStatus' => 1,
322 '{urn:iControl}LocalLB.PersistenceMode' => 1,
323 '{urn:iControl}LocalLB.ProfileContextType' => 1,
324 '{urn:iControl}LocalLB.ProfileMode' => 1,
325 '{urn:iControl}LocalLB.ProfileType' => 1,
326 '{urn:iControl}LocalLB.RamCacheCacheControlMode' => 1,
327 '{urn:iControl}LocalLB.RtspProxyType' => 1,
328 '{urn:iControl}LocalLB.SSLOption' => 1,
329 '{urn:iControl}LocalLB.ServerSSLCertificateMode' => 1,
330 '{urn:iControl}LocalLB.ServiceDownAction' => 1,
331 '{urn:iControl}LocalLB.SessionStatus' => 1,
332 '{urn:iControl}LocalLB.SnatType' => 1,
333 '{urn:iControl}LocalLB.TCPCongestionControlMode' => 1,
334 '{urn:iControl}LocalLB.TCPOptionMode' => 1,
335 '{urn:iControl}LocalLB.UncleanShutdownMode' => 1,
336 '{urn:iControl}LocalLB.VirtualAddressStatusDependency' => 1,
337 '{urn:iControl}LocalLB.Class.ClassType' => 1,
338 '{urn:iControl}LocalLB.Class.FileFormatType' => 1,
339 '{urn:iControl}LocalLB.Class.FileModeType' => 1,
340 '{urn:iControl}LocalLB.Monitor.IntPropertyType' => 1,
341 '{urn:iControl}LocalLB.Monitor.StrPropertyType' => 1,
342 '{urn:iControl}LocalLB.Monitor.TemplateType' => 1,
343 '{urn:iControl}LocalLB.ProfilePersistence.PersistenceHashMethod' => 1,
344 '{urn:iControl}LocalLB.ProfileUserStatistic.UserStatisticKey' => 1,
345 '{urn:iControl}LocalLB.RAMCacheInformation.RAMCacheVaryType' => 1,
346 '{urn:iControl}LocalLB.RateClass.DirectionType' => 1,
347 '{urn:iControl}LocalLB.RateClass.DropPolicyType' => 1,
348 '{urn:iControl}LocalLB.RateClass.QueueType' => 1,
349 '{urn:iControl}LocalLB.RateClass.UnitType' => 1,
350 '{urn:iControl}LocalLB.VirtualServer.VirtualServerCMPEnableMode' => 1,
351 '{urn:iControl}LocalLB.VirtualServer.VirtualServerType' => 1,
352 '{urn:iControl}Management.DebugLevel' => 1,
353 '{urn:iControl}Management.LDAPPasswordEncodingOption' => 1,
354 '{urn:iControl}Management.LDAPSSLOption' => 1,
355 '{urn:iControl}Management.LDAPSearchMethod' => 1,
356 '{urn:iControl}Management.LDAPSearchScope' => 1,
357 '{urn:iControl}Management.OCSPDigestMethod' => 1,
358 '{urn:iControl}Management.ZoneType' => 1,
359 '{urn:iControl}Management.EventNotification.EventDataType' => 1,
360 '{urn:iControl}Management.EventSubscription.AuthenticationMode' => 1,
361 '{urn:iControl}Management.EventSubscription.EventType' => 1,
362 '{urn:iControl}Management.EventSubscription.ObjectType' => 1,
363 '{urn:iControl}Management.EventSubscription.SubscriptionStatusCode' => 1,
364 '{urn:iControl}Management.KeyCertificate.CertificateType' => 1,
365 '{urn:iControl}Management.KeyCertificate.KeyType' => 1,
366 '{urn:iControl}Management.KeyCertificate.ManagementModeType' => 1,
367 '{urn:iControl}Management.KeyCertificate.SecurityType' => 1,
368 '{urn:iControl}Management.KeyCertificate.ValidityType' => 1,
369 '{urn:iControl}Management.Provision.ProvisionLevel' => 1,
370 '{urn:iControl}Management.SNMPConfiguration.AuthType' => 1,
371 '{urn:iControl}Management.SNMPConfiguration.DiskCheckType' => 1,
372 '{urn:iControl}Management.SNMPConfiguration.LevelType' => 1,
373 '{urn:iControl}Management.SNMPConfiguration.ModelType' => 1,
374 '{urn:iControl}Management.SNMPConfiguration.PrefixType' => 1,
375 '{urn:iControl}Management.SNMPConfiguration.PrivacyProtocolType' => 1,
376 '{urn:iControl}Management.SNMPConfiguration.SinkType' => 1,
377 '{urn:iControl}Management.SNMPConfiguration.TransportType' => 1,
378 '{urn:iControl}Management.SNMPConfiguration.ViewType' => 1,
379 '{urn:iControl}Management.UserManagement.UserRole' => 1,
380 '{urn:iControl}Networking.FilterAction' => 1,
381 '{urn:iControl}Networking.FlowControlType' => 1,
382 '{urn:iControl}Networking.LearningMode' => 1,
383 '{urn:iControl}Networking.MediaStatus' => 1,
384 '{urn:iControl}Networking.MemberTagType' => 1,
385 '{urn:iControl}Networking.MemberType' => 1,
386 '{urn:iControl}Networking.PhyMasterSlaveMode' => 1,
387 '{urn:iControl}Networking.RouteEntryType' => 1,
388 '{urn:iControl}Networking.STPLinkType' => 1,
389 '{urn:iControl}Networking.STPModeType' => 1,
390 '{urn:iControl}Networking.STPRoleType' => 1,
391 '{urn:iControl}Networking.STPStateType' => 1,
392 '{urn:iControl}Networking.ARP.NDPState' => 1,
393 '{urn:iControl}Networking.Interfaces.MediaType' => 1,
394 '{urn:iControl}Networking.ProfileWCCPGRE.WCCPGREForwarding' => 1,
395 '{urn:iControl}Networking.STPInstance.PathCostType' => 1,
396 '{urn:iControl}Networking.SelfIPPortLockdown.AllowMode' => 1,
397 '{urn:iControl}Networking.Trunk.DistributionHashOption' => 1,
398 '{urn:iControl}Networking.Trunk.LACPTimeoutOption' => 1,
399 '{urn:iControl}Networking.Trunk.LinkSelectionPolicy' => 1,
400 '{urn:iControl}Networking.Tunnel.TunnelDirection' => 1,
401 '{urn:iControl}Networking.VLANGroup.VLANGroupTransparency' => 1,
402 '{urn:iControl}Networking.iSessionLocalInterface.NatSourceAddress' => 1,
403 '{urn:iControl}Networking.iSessionPeerDiscovery.DiscoveryMode' => 1,
404 '{urn:iControl}Networking.iSessionPeerDiscovery.FilterMode' => 1,
405 '{urn:iControl}Networking.iSessionRemoteInterface.NatSourceAddress' => 1,
406 '{urn:iControl}Networking.iSessionRemoteInterface.OriginState' => 1,
407 '{urn:iControl}System.CPUMetricType' => 1,
408 '{urn:iControl}System.FanMetricType' => 1,
409 '{urn:iControl}System.HardwareType' => 1,
410 '{urn:iControl}System.PSMetricType' => 1,
411 '{urn:iControl}System.TemperatureMetricType' => 1,
412 '{urn:iControl}System.ConfigSync.ConfigExcludeComponent' => 1,
413 '{urn:iControl}System.ConfigSync.ConfigIncludeComponent' => 1,
414 '{urn:iControl}System.ConfigSync.LoadMode' => 1,
415 '{urn:iControl}System.ConfigSync.SaveMode' => 1,
416 '{urn:iControl}System.ConfigSync.SyncMode' => 1,
417 '{urn:iControl}System.Disk.RAIDStatus' => 1,
418 '{urn:iControl}System.Failover.FailoverMode' => 1,
419 '{urn:iControl}System.Failover.FailoverState' => 1,
420 '{urn:iControl}System.Services.ServiceAction' => 1,
421 '{urn:iControl}System.Services.ServiceStatusType' => 1,
422 '{urn:iControl}System.Services.ServiceType' => 1,
423 '{urn:iControl}System.Statistics.GtmIQueryState' => 1,
424 '{urn:iControl}System.Statistics.GtmPathStatisticObjectType' => 1,
425 };
426  
427 package BigIP::iControlDeserializer;
428 2 @BigIP::iControlDeserializer::ISA = 'SOAP::Deserializer';
429  
430 0 ▶ sub typecast {
Subroutine typecast: not called CC=4 SCAR=30.0
431 0 my ($self, $value, $name, $attrs, $children, $type) = @_;
432 0 my $retval = undef;
433 0 ▶ if (not defined $type or not defined $urn_map->{$type}) {return $retval}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $type and defined $BigIP::iControl::urn_map->{$type}) 0 0 0
Condition0%0/3
defined $type and defined $BigIP::iControl::urn_map->{$type}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $type and defined $BigIP::iControl::urn_map->{$type}
defined $type defined $BigIP::iControl::urn_map->{$type}
Truth table0%0/3
A and B
A= defined $typeB= defined $BigIP::iControl::urn_map->{$type}
ABresult
0X0
100
111
434 0 ▶ if ($urn_map->{$type} == 1) {$retval = $value}
Branch: 1 branch
BranchTrueFalseTotal
if ($BigIP::iControl::urn_map->{$type} == 1) 0 0 0
435 0 return $retval;
436 }
437 }
438  
439 =head2 METHODS
440  
441 =head3 new (%args)
442  
443 my $ic = BigIP::iControl->new(
444 server => 'bigip.company.com',
445 username => 'api_user',
446 password => 'my_password',
447 port => 443,
448 proto => 'https',
449 verify_hostname => 0
450 );
451  
452 Constructor method. Creates a new BigIP::iControl object representing a single interface into the iControl
453 API of the target system.
454  
455 Required parameters are:
456  
457 =over 3
458  
459 =item server
460  
461 The target F5 BIGIP device. The supplied value may be either an IP address, FQDN or resolvable hostname.
462  
463 =item username
464  
465 The username with which to connect to the iControl API.
466  
467 =item password
468  
469 The password with which to connect to the iControl API.
470  
471 =item port
472  
473 The port on which to connect to the iControl API. If not specified this value will default to 443.
474  
475 =item proto
476  
477 The protocol with to use for communications with the iControl API (should be either http or https). If not specified
478 this value will default to https.
479  
480 =item verify_hostname
481  
482 If TRUE when used with a secure connection then the client will ensure that the target server has a valid certificate
483 matching the expected hostname.
484  
485 =back
486  
487 =cut
488  
489 0 ▶sub new {
Subroutine new: not called CC=6 SCAR=37.4
Pod documented
490 0 my ($class, %args) = @_;
491 0 my $self = bless {}, $class;
492 0 ▶ defined $args{server} ? $self->{server} = $args{server} : croak 'Constructor failed: server not defined';
Branch: 1 branch
BranchTrueFalseTotal
defined $args{'server'} ? : 0 0 0
493 0 ▶ defined $args{username} ? $self->{username} = $args{username} : croak 'Constructor failed: username not defined';
Branch: 1 branch
BranchTrueFalseTotal
defined $args{'username'} ? : 0 0 0
494 0 ▶ defined $args{password} ? $self->{password} = $args{password} : croak 'Constructor failed: password not defined';
Branch: 1 branch
BranchTrueFalseTotal
defined $args{'password'} ? : 0 0 0
495 0 ▶ $self->{proto} = ($args{proto} or 'https');
Condition0%0/2
$args{'proto'} || 'https'
l!l
00
MC/DC0%0/1
$args{'proto'} || 'https'
$args{'proto'}
Truth table0%0/2
A
A= $args{'proto'}
Aresult
11
00
496 0 ▶ $self->{port} = ($args{port} or '443');
Condition0%0/2
$args{'port'} || '443'
l!l
00
MC/DC0%0/1
$args{'port'} || '443'
$args{'port'}
Truth table0%0/2
A
A= $args{'port'}
Aresult
11
00
497 0 $self->{_client} = SOAP::Lite ->proxy($self->{proto}.'://'.$self->{server}.':'.$self->{port}.'/iControl/iControlPortal.cgi')
498 ->deserializer(BigIP::iControlDeserializer->new());
499 0 $self->{_client}->transport->http_request->header('Authorization' => 'Basic ' . MIME::Base64::encode("$self->{username}:$self->{password}") );
500 0 eval { $self->{_client}->transport->ssl_opts( verify_hostname => $args{verify_hostname} ) };
501 0 return $self;
502 }
503  
504 0 ▶sub _set_uri {
Subroutine _set_uri: not called CC=1 SCAR=6.9
505 0 my ($self, $module, $interface) = @_;
506 0 $self->{_client}->uri("urn:iControl:$module/$interface");
507 0 return 1
508 }
509  
510 0 ▶sub _unset_uri {
Subroutine _unset_uri: not called CC=1 SCAR=6.9
511 0 undef $_[0]->{_client}->{uri};
512 }
513  
514 0 ▶sub _get_username {
Subroutine _get_username: not called CC=1 SCAR=6.9
515 0 return $_[0]->{username};
516 }
517  
518 # We do most of our request validation in this method so it is unnessecarily complex, not entirely intuitive, uglier
519 # than a hat full of assholes and slightly less elegant than Lindsay Lohan exiting a limo.
520 #
521 # By pushing complexity from our public methods into here, we can implement some basic checks against known bad
522 # invocations rather than just passing them through to iControl to handle.
523 #
524 # It also allows us to limit the over-riding or abuse of the internal _request method by limiting
525 # invocations to the parameter format specified in global $modules struct.
526 #
527 # We can then implement accessor methods by essentially copying the API invocation from the reference. For example,
528 # to implement the System::SystemInfo::get_system_id API call, the reference gives the prototype as;
529 #
530 # String get_system_id();
531 #
532 # Note also that the API uses the namespace convention of Module::Interface::Method, so that our get_system_id method
533 # is implemented in the SystemInfo interface, which is under the System module.
534 #
535 # Implementing this, we would first add the method to our $modules struct maintaining the API heirarchy;
536 #
537 # $modules => {
538 # System => {
539 # SystemInfo => {
540 # get_system_id => 0
541 #
542 # Analogous to:
543 #
544 # $modules => {
545 # Module => {
546 # Interface => {
547 # Method => parameters
548 #
549 # A value of 0 is used for get_system_id as the method prototype takes no parameters. For methods taking a single
550 # parameter, we would use the value of the required parameter name, for methods taking numerous parameters, we would
551 # use a hash containing a key for each parameter.
552 #
553 # Our method is then created as an invocation to the private _request method setting the value of the module,
554 # interface and method arguments as per the API reference. i.e.
555 #
556 # module => 'System'
557 # interface => 'SystemInfo'
558 # method => 'get_system_id'
559 #
560 # Which is intuitively translated into the implementation below;
561 #
562 # sub get_cluster_enabled_state {
563 # my $self = shift;
564 # return $self->_request(module => 'System', interface => 'Cluster', method => 'get_cluster_enabled_state');
565 # }
566 #
567  
568 0 ▶sub _request {
Subroutine _request: not called CC=13 SCAR=52.0
569 0 my ($self, %args)= @_;
570 $args{module} and exists $modules->{$args{module}}
571 0 ▶ or return 'Request error: unknown module name: "'.$args{module}.'"';
Branch: 1 branch
BranchTrueFalseTotal
$args{"module"} and exists $$BigIP::iControl::modules{$args{"module"}} or return 'Request error: unknown module name: "' . $args{"module"} . '"' 0 0 0
Condition0%0/3
$args{"module"} and exists $$BigIP::iControl::modules{$args{"module"}}
!ll&&!rl&&r
000
MC/DC0%0/2
$args{"module"} and exists $$BigIP::iControl::modules{$args{"module"}}
$args{"module"} exists $$BigIP::iControl::modules{$args{"module"}}
Truth table0%0/3
A and B
A= $args{"module"}B= exists $$BigIP::iControl::modules{$args{"module"}}
ABresult
0X0
100
111
572 $args{interface}and exists $modules->{$args{module}}->{$args{interface}}
573 0 ▶ or return "Request error: unknown interface name for module $args{module}: \"$args{interface}\"";
Branch: 1 branch
BranchTrueFalseTotal
$args{"interface"} and exists $$BigIP::iControl::modules{$args{"module"}}{$args{"interface"}} or return qq[Request error: unknown interface name for module $args{"module"}: "$args{"interface"}"] 0 0 0
Condition0%0/3
$args{"interface"} and exists $$BigIP::iControl::modules{$args{"module"}}{$args{"interface"}}
!ll&&!rl&&r
000
MC/DC0%0/2
$args{"interface"} and exists $$BigIP::iControl::modules{$args{"module"}}{$args{"interface"}}
$args{"interface"} exists $$BigIP::iControl::modules{$args{"module"}}{$args{"interface"}}
Truth table0%0/3
A and B
A= $args{"interface"}B= exists $$BigIP::iControl::modules{$args{"module"}}{$args{"interface"}}
ABresult
0X0
100
111
574 $args{method} and exists $modules->{$args{module}}->{$args{interface}}->{$args{method}}
575 0 ▶ or return "Request error: unknown method name for module $args{module} and interface $args{interface}: \"$args{method}\"";
Branch: 1 branch
BranchTrueFalseTotal
$args{"method"} and exists $$BigIP::iControl::modules{$args{"module"}}{$args{"interface"}}{$args{"method"}} or return qq[Request error: unknown method name for module $args{"module"} and interface $args{"interface"}: "$args{"method"}"] 0 0 0
Condition0%0/3
$args{"method"} and exists $$BigIP::iControl::modules{$args{"module"}}{$args{"interface"}}{$args{"method"}}
!ll&&!rl&&r
000
MC/DC0%0/2
$args{"method"} and exists $$BigIP::iControl::modules{$args{"module"}}{$args{"interface"}}{$args{"method"}}
$args{"method"} exists $$BigIP::iControl::modules{$args{"module"}}{$args{"interface"}}{$args{"method"}}
Truth table0%0/3
A and B
A= $args{"method"}B= exists $$BigIP::iControl::modules{$args{"module"}}{$args{"interface"}}{$args{"method"}}
ABresult
0X0
100
111
576  
577 0 my @params = ();
578  
579 0 ▶ if ($modules->{$args{module}}->{$args{interface}}->{$args{method}}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$BigIP::iControl::modules{$args{"module"}}{$args{"interface"}}{$args{"method"}}) 0 0 0
580  
581 0 foreach my $arg (keys %{$args{data}}) {
582  
583 0 ▶ if (ref $modules->{$args{module}}->{$args{interface}}->{$args{method}} eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $$BigIP::iControl::modules{$args{'module'}}{$args{'interface'}}{$args{'method'}} eq 'HASH') { } 0 0 0
584 0 ▶ exists $modules->{$args{module}}->{$args{interface}}->{$args{method}}->{$arg}
Branch: 1 branch
BranchTrueFalseTotal
exists $$BigIP::iControl::modules{$args{"module"}}{$args{"interface"}}{$args{"method"}}{$arg} or croak(qq[Request error: method $args{"method"} for interface $args{"interface"} in module $args{"module"} requires ] . qq[mandatory data parameter "$$BigIP::iControl::modules{$args{"module"}}{$args{"interface"}}{$args{"method"}}{$arg}"]) 0 0 0
585 or croak "Request error: method $args{method} for interface $args{interface} in module $args{module} requires " .
586 "mandatory data parameter \"$modules->{$args{module}}->{$args{interface}}->{$args{method}}->{$arg}\"";
587 0 push @params, SOAP::Data->name($arg => $args{data}{$arg});
588 }
589 else {
590 $arg eq $modules->{$args{module}}->{$args{interface}}->{$args{method}}
591 0 ▶ or croak "Request error: method $args{method} for interface $args{interface} in module $args{module} requires " .
Branch: 1 branch
BranchTrueFalseTotal
$arg eq $$BigIP::iControl::modules{$args{"module"}}{$args{"interface"}}{$args{"method"}} or croak(qq[Request error: method $args{"method"} for interface $args{"interface"} in module $args{"module"} requires ] . qq[mandatory data parameter "$$BigIP::iControl::modules{$args{"module"}}{$args{"interface"}}{$args{"method"}}"]) 0 0 0
592 "mandatory data parameter \"$modules->{$args{module}}->{$args{interface}}->{$args{method}}\"";
593 0 push @params, SOAP::Data->name(%{$args{data}});
594 }
595 }
596 }
597  
598 0 $self->_set_uri($args{module}, $args{interface});
599 0 my $method = $args{method};
600 0 my $query = $self->{_client}->$method(@params);
601 0 ▶ $query->fault and confess('SOAP call failed: ', $query->faultstring());
Branch: 1 branch
BranchTrueFalseTotal
$query->fault and confess("SOAP call failed: ", $query->faultstring) 0 0 0
602 0 $self->_unset_uri();
603 0 return $query->result;
604 }
605  
606 0 ▶sub __get_timestamp {
Subroutine __get_timestamp: not called CC=2 SCAR=17.9
607 0 my $time;
608 my %ts;
609 0 @ts{qw(year month day hour minute second)} = ((localtime(time))[5,4,3,2,1,0]);
610 0 $ts{year}+=1900;
611 0 $ts{month}++;
612  
613 0 foreach (keys %ts) {
614 0 $time->{$_} = $ts{$_};
615 }
616
617 0 return __process_timestamp($time);
618 }
619  
620 0 ▶sub __process_timestamp {
Subroutine __process_timestamp: not called CC=1 SCAR=6.9
621 0 my $time_stamp = shift;
622 return (__zero_fill($time_stamp->{year}) . '-' .
623 __zero_fill($time_stamp->{month}) . '-' .
624 __zero_fill($time_stamp->{day}) . '-' .
625 __zero_fill($time_stamp->{hour}) . '-' .
626 __zero_fill($time_stamp->{minute}) . '-' .
627 0 __zero_fill($time_stamp->{second}))
628 }
629  
630 0 ▶sub __process_statistics {
Subroutine __process_statistics: not called CC=2 SCAR=17.9
631 0 my $statistics = shift;
632  
633 0 my %stat_obj = (timestamp => __process_timestamp($statistics->{time_stamp}));
634  
635 0 foreach (@{@{$statistics->{statistics}}[0]->{statistics}}) {
636 0 my $type = $_->{type};
637 0 $stat_obj{stats}{$type} = Math::BigInt->new("0x" . unpack("H*", pack("N2",$_->{value}{high}, $_->{value}{low})))->bstr;
638 }
639
640 0 return %stat_obj
641 }
642  
643 0 ▶sub __process_pool_member_statistics {
Subroutine __process_pool_member_statistics: not called CC=2 SCAR=17.9
644 0 my $statistics = shift;
645 0 my $timestamp = @{$statistics}[0]->{time_stamp};
646 0 my %stat_obj;
647  
648 0 foreach (@{@{$statistics}[0]->{statistics}}) {
649 0 my $node = $_->{member}->{address}.':'.$_->{member}->{port};
650 0 $stat_obj{$node}= {__process_statistics( { time_stamp => $timestamp, statistics => [ $_ ] } )};
651 }
652
653 0 return %stat_obj
654 }
655  
656 0 ▶sub __process_cpu_statistics {
Subroutine __process_cpu_statistics: not called CC=3 SCAR=24.8
657 0 my $statistics = shift;
658 0 my $cpu_cnt = 0;
659 0 my %stat_obj = (timestamp => __get_timestamp);
660  
661 0 foreach my $cpu (@{$statistics}) {
662  
663 0 foreach (@{$cpu}) {
664 0 $stat_obj{stats}{$cpu_cnt}{$_->{type}} = (($_->{value}{high})<<32)|(abs $_->{value}{low});
665 }
666
667 0 $cpu_cnt++;
668 }
669  
670 0 return %stat_obj
671 }
672  
673 0 ▶sub __zero_fill {
Subroutine __zero_fill: not called CC=2 SCAR=17.9
674 0 ▶ return ($_[0] < 10 ? '0' . $_[0] : $_[0])
Branch: 1 branch
BranchTrueFalseTotal
$_[0] < 10 ? : 0 0 0
675 }
676  
677 =head3 get_system_information
678  
679 Return a SystemInformation struct containing the identifying attributes of the operating system.
680 The struct information is described below;
681  
682 Member Type Description
683 ---------- ---------- ----------
684 system_name String The name of the operating system implementation.
685 host_name String The host name of the system.
686 os_release String The release level of the operating system.
687 os_machine String The hardware platform CPU type.
688 os_version String The version string for the release of the operating system.
689 platform String The platform of the device.
690 product_category String The product category of the device.
691 chassis_serial String The chassis serial number.
692 switch_board_serial String The serial number of the switch board.
693 switch_board_part_revision String The part revision number of the switch board.
694 host_board_serial String The serial number of the host motherboard.
695 host_board_part_revision String The part revision number of the host board.
696 annunciator_board_serial String The serial number of the annuciator board.
697 annunciator_board_part_revision String The part revision number of the annunciator board.
698  
699 =cut
700  
701 0 ▶sub get_system_information {
Subroutine get_system_information: not called CC=1 SCAR=6.9
Pod documented
702 0 return $_[0]->_request(module => 'System', interface => 'SystemInfo', method => 'get_system_information')
703 }
704  
705 =head3 get_system_id ()
706  
707 Gets the unique identifier for the system.
708  
709 =cut
710  
711 0 ▶sub get_system_id {
Subroutine get_system_id: not called CC=1 SCAR=6.9
Pod documented
712 0 return $_[0]->_request(module => 'System', interface => 'SystemInfo', method => 'get_system_id')
713 }
714  
715 =head3 get_cpu_metrics ()
716  
717 Gets the CPU metrics for the CPU(s) on the platform.
718  
719 =cut
720  
721 0 ▶sub get_cpu_metrics {
Subroutine get_cpu_metrics: not called CC=1 SCAR=6.9
Pod documented
722 0 return $_[0]->_request(module => 'System', interface => 'SystemInfo', method => 'get_cpu_metrics');
723 }
724  
725 =head3 get_cpu_metrics_stringified ()
726  
727 Gets the CPU metrics for the CPU(s) on the platform.
728  
729 =cut
730  
731 0 ▶sub get_cpu_metrics_stringified {
Subroutine get_cpu_metrics_stringified: not called CC=2 SCAR=17.9
Pod documented
732 0 my $self = shift;
733 0 my $res;
734  
735 0 my $metrics = $self->get_cpu_metrics;
736 0 $res->{timestamp}= __get_timestamp;
737  
738 0 foreach (@{$metrics->{cpus}}) {
739 0 $res->{@{$_}[0]->{value}}->{temp} = @{$_}[1]->{value};
740 0 $res->{@{$_}[0]->{value}}->{fan} = @{$_}[2]->{value};
741 }
742  
743 0 return $res
744 }
745  
746 0 ▶sub __get_cpu_metric {
Subroutine __get_cpu_metric: not called CC=2 SCAR=17.9
747 0 my($self,$cpu,$metric)=@_;
748 0 my $metrics = $self->get_cpu_metrics_stringified();
749 0 ▶ exists $metrics->{$cpu} and return $metrics->{$cpu}->{$metric};
Branch: 1 branch
BranchTrueFalseTotal
exists $metrics->{$cpu} and return $metrics->{$cpu}{$metric} 0 0 0
750 }
751  
752 =head3 get_cpu_fan_speed ($cpu)
753  
754 Returns the current CPU fan speed in RPM for the specified CPU.
755  
756 =cut
757  
758 0 ▶sub get_cpu_fan_speed {
Subroutine get_cpu_fan_speed: not called CC=1 SCAR=6.9
Pod documented
759 0 return $_[0]->__get_cpu_metric($_[1],'fan')
760 }
761  
762 =head3 get_cpu_temp ($cpu)
763  
764 Returns the current CPU temperature degrees celcius for the specified CPU.
765  
766 =cut
767  
768 0 ▶sub get_cpu_temp {
Subroutine get_cpu_temp: not called CC=1 SCAR=6.9
Pod documented
769 0 return $_[0]->__get_cpu_metric($_[1],'temp')
770 }
771  
772 =head3 get_cpu_usage_extended_information ()
773  
774 =cut
775  
776 0 ▶sub get_cpu_usage_extended_information {
Subroutine get_cpu_usage_extended_information: not called CC=2 SCAR=17.9
Pod documented
777 0 my($self,$id) = @_;
778 0 ▶ $id ||= $self->{server};
Condition0%0/3
$id ||= $self->{"server"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$id ||= $self->{"server"}
$id $self->{"server"}
Truth table0%0/3
A ||= B
A= $idB= $self->{"server"}
ABresult
1X1
011
000
779 0 return $self->_request(module => 'System', interface => 'SystemInfo', method => 'get_cpu_usage_extended_information', data => {host_ids => [$id]});
780 }
781  
782 =head3 get_cpu_usage_extended_information_stringified ()
783  
784 =cut
785  
786 0 ▶sub get_cpu_usage_extended_information_stringified {
Subroutine get_cpu_usage_extended_information_stringified: not called CC=1 SCAR=6.9
Pod documented
787 0 my($self,$id) = shift;
788 0 __process_cpu_statistics(@{$self->get_cpu_usage_extended_information($id)->{hosts}}[0]->{statistics});
789 }
790  
791 =head3 get_cluster_list ()
792  
793 Gets a list of the cluster names.
794  
795 =cut
796  
797 0 ▶sub get_cluster_list {
Subroutine get_cluster_list: not called CC=1 SCAR=6.9
Pod documented
798 0 return $_[0]->_request(module => 'System', interface => 'Cluster', method => 'get_list');
799 }
800  
801 =head3 get_failover_mode ()
802  
803 Gets the current fail-over mode that the device is running in.
804  
805 =cut
806  
807 0 ▶sub get_failover_mode {
Subroutine get_failover_mode: not called CC=1 SCAR=6.9
Pod documented
808 0 return $_[0]->_request(module => 'System', interface => 'Failover', method => 'get_failover_mode');
809 }
810  
811 =head3 get_failover_state ()
812  
813 Gets the current fail-over state that the device is running in.
814  
815 =cut
816  
817 0 ▶sub get_failover_state {
Subroutine get_failover_state: not called CC=1 SCAR=6.9
Pod documented
818 0 return $_[0]->_request(module => 'System', interface => 'Failover', method => 'get_failover_state');
819 }
820  
821 =head3 is_redundant ()
822  
823 Returns a boolean indicating the redundancy state of the device.
824  
825 =cut
826  
827 0 ▶sub is_redundant {
Subroutine is_redundant: not called CC=1 SCAR=6.9
Pod documented
828 0 return $_[0]->_request(module => 'System', interface => 'Failover', method => 'is_redundant');
829 }
830  
831 =head3 get_cluster_enabled_state ()
832  
833 Gets the cluster enabled states.
834  
835 =cut
836  
837 0 ▶sub get_cluster_enabled_state {
Subroutine get_cluster_enabled_state: not called CC=1 SCAR=6.9
Pod documented
838 0 return $_[0]->_request(module => 'System', interface => 'Cluster', method => 'get_cluster_enabled_state');
839 }
840  
841 =head3 get_service_list ()
842  
843 Returns a list of all supported services on this host.
844  
845 =cut
846  
847 0 ▶sub get_service_list {
Subroutine get_service_list: not called CC=1 SCAR=6.9
Pod documented
848 0 return @{$_[0]->_request(module => 'System', interface => 'Services', method => 'get_list')}
849 }
850  
851 =head3 get_service_status ()
852  
853 Returns the status of the specified service.
854  
855 =cut
856  
857 0 ▶sub get_service_status {
Subroutine get_service_status: not called CC=1 SCAR=6.9
Pod documented
858 0 my($self,$service)= shift;
859 0 return $self->_request(module => 'System', interface => 'Services', method => 'get_service_status', data => { services => $service });
860 }
861  
862 =head3 get_all_service_statuses ()
863  
864 Returns the status of all services.
865  
866 =cut
867  
868 0 ▶sub get_all_service_statuses {
Subroutine get_all_service_statuses: not called CC=2 SCAR=17.9
Pod documented
869 0 my $self = shift;
870 0 my %res;
871  
872 0 foreach my $service (@{$self->_request(module => 'System', interface => 'Services', method => 'get_all_service_statuses')}) {
873 $res{$service->{service}} = $service->{status}
874 0 }
875  
876 0 return %res
877 }
878  
879 =head3 save_configuration ($filename)
880  
881 $ic->save_configuration('backup.ucs');
882  
883 # is equivalent to
884  
885 $ic->save_configuration('backup');
886
887 # Not specifying a filename will use today's date in the
888 # format YYYYMMDD as the filename.
889  
890 $ic->save_configuration();
891  
892 # is equivalent to
893  
894 $ic->save_configuration('today');
895
896  
897 Saves the current configurations on the target device.
898  
899 This method takes a single optional parameter; the filename to which the configuration should be saved. The file
900 extension B<.ucs> will be suffixed to the filename if missing from the supplied filename.
901  
902 Specifying no optional filename parameter or using the filename B<today> will use the current date as the filename
903 of the saved configuration file in the format B<YYYYMMDD>.
904  
905 =cut
906  
907 0 ▶sub __save_configuration {
Subroutine __save_configuration: not called CC=4 SCAR=30.0
908 0 my ($self,$filename,$flag) = @_;
909  
910 0 ▶ if (($filename eq 'today') or ($filename eq '')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename eq "today" or $filename eq "") 0 0 0
Condition0%0/3
$filename eq "today" or $filename eq ""
l!l&&r!l&&!r
000
MC/DC0%0/2
$filename eq "today" or $filename eq ""
$filename eq "today" $filename eq ""
Truth table0%0/3
A or B
A= $filename eq "today"B= $filename eq ""
ABresult
1X1
011
000
911 0 $filename = __get_timestamp();
912 }
913
914 0 ▶ $flag or $flag = 'SAVE_FULL';
Branch: 1 branch
BranchTrueFalseTotal
$flag or $flag = "SAVE_FULL" 0 0 0
915  
916 0 $self->_request(module => 'System', interface => 'ConfigSync', method => 'save_configuration', data => { filename => $filename, save_flag => $flag});
917  
918 0 return 1
919 }
920  
921 0 ▶sub save_configuration {
Subroutine save_configuration: not called CC=1 SCAR=6.9
Pod documented
922 0 my ($self,$filename) = @_;
923 0 return ($self->__save_configuration($filename,'SAVE_FULL'));
924 }
925  
926 =head3 save_base_configuration ()
927  
928 $ic->save_base_configuration();
929  
930 Saves only the base configuration (VLANs, self IPs...). The filename specified when used with this mode will
931 be ignored, since configuration will be saved to /config/bigip_base.conf by default.
932  
933 =cut
934  
935 0 ▶sub save_base_configuration {
Subroutine save_base_configuration: not called CC=1 SCAR=6.9
Pod documented
936 0 return ($_[0]->__save_configuration('ignore','SAVE_BASE_LEVEL_CONFIG'))
937 }
938  
939 =head3 save_high_level_configuration ()
940  
941 $ic->save_high_level_configuration();
942  
943 Saves only the high-level configuration (virtual servers, pools, members, monitors...). The filename specified
944 when used with this mode will be ignored, since configuration will be saved to /config/bigip.conf by default.
945  
946 =cut
947  
948 0 ▶sub save_high_level_configuration {
Subroutine save_high_level_configuration: not called CC=1 SCAR=6.9
Pod documented
949 0 return ($_[0]->__save_configuration('ignore','SAVE_HIGH_LEVEL_CONFIG'))
950 }
951  
952  
953 =head3 download_configuration ($filename)
954  
955 This method downloads a saved UCS configuration from the target device.
956  
957 =cut
958  
959 0 ▶sub download_configuration {
Subroutine download_configuration: not called CC=5 SCAR=34.0
Pod documented
960 0 my ($self,$config_name,$local_file) = @_;
961 0 my $chunk = 65536;
962 0 my $offset = 0;
963 0 my $data;
964  
965 0 ▶ $config_name or croak 'No configuration file specified';
Branch: 1 branch
BranchTrueFalseTotal
$config_name or croak("No configuration file specified") 0 0 0
966  
967 0 ▶ open my $fh, '+>', $local_file or croak "Unable to open local file: $local_file";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "+>", $local_file or croak("Unable to open local file: $local_file") 0 0 0
968 0 binmode($fh);
969  
970 0 while (1) {
971 0 $data = $self->_request(module => 'System', interface => 'ConfigSync', method => 'download_configuration', data => {config_name => $config_name, chunk_size => $chunk, file_offset => $offset});
972 0 print $fh $data->{file_data};
973 0 ▶ last if (($data->{chain_type} eq 'FILE_LAST') or ($data->{chain_type} eq 'FILE_FIRST_AND_LAST'));
Branch: 1 branch
BranchTrueFalseTotal
if $data->{"chain_type"} eq "FILE_LAST" or $data->{"chain_type"} eq "FILE_FIRST_AND_LAST" 0 0 0
Condition0%0/3
$data->{"chain_type"} eq "FILE_LAST" or $data->{"chain_type"} eq "FILE_FIRST_AND_LAST"
l!l&&r!l&&!r
000
MC/DC0%0/2
$data->{"chain_type"} eq "FILE_LAST" or $data->{"chain_type"} eq "FILE_FIRST_AND_LAST"
$data->{"chain_type"} eq "FILE_LAST" $data->{"chain_type"} eq "FILE_FIRST_AND_LAST"
Truth table0%0/3
A or B
A= $data->{"chain_type"} eq "FILE_LAST"B= $data->{"chain_type"} eq "FILE_FIRST_AND_LAST"
ABresult
1X1
011
000
974 0 $offset+=(length($data->{file_data}));
975 }
976  
977 0 close $fh;
978 0 return 1
979 }
980  
981 =head3 get_configuration_list ()
982  
983 my %config_list = $ic->get_configuration_list();
984  
985 Returns a list of the configuration archives present on the system. the list is returned as a hash
986 with the name of the configuration archive as the key, and the creation date of the configuration
987 archive as the value.
988  
989 The creation date uses the native date format of:
990  
991 Day Mon D HH:MM:SS YYYY
992  
993 Where B<Day> is the three-letter common abbreviation of the day name, B<Mon> is the three letter common
994 abbreviation of the month name and B<D> has the value range 1-31 with no leading zeros.
995  
996 =cut
997  
998 0 ▶sub get_configuration_list {
Subroutine get_configuration_list: not called CC=2 SCAR=17.9
Pod documented
999 0 my $self = shift;
1000 0 my %res;
1001  
1002 0 foreach (@{$self->_request(module => 'System', interface => 'ConfigSync', method => 'get_configuration_list')}) {
1003 $res{$_->{file_name}} = $_->{file_datetime}
1004 0 }
1005  
1006 0 return %res;
1007 }
1008  
1009 =head3 delete_configuration ()
1010  
1011 $ic->delete_configuration('file.ucs');
1012  
1013 Deletes the specified configuration archive from the system.
1014  
1015 =cut
1016  
1017 0 ▶sub delete_configuration {
Subroutine delete_configuration: not called CC=2 SCAR=17.9
Pod documented
1018 0 my ($self,$filename) = @_;
1019 0 ▶ $filename or croak 'No filename specified';
Branch: 1 branch
BranchTrueFalseTotal
$filename or croak("No filename specified") 0 0 0
1020 0 return $self->_request(module => 'System', interface => 'ConfigSync', method => 'delete_configuration', data => { filename => $filename });
1021 }
1022  
1023 0 ▶sub _download_file {
Subroutine _download_file: not called CC=5 SCAR=34.0
1024 0 my ($self,$config_name,$local_file) = @_;
1025 0 my $chunk = 65536;
1026 0 my $offset = 0;
1027 0 my $data;
1028  
1029 0 ▶ $config_name or croak 'No configuration file specified';
Branch: 1 branch
BranchTrueFalseTotal
$config_name or croak("No configuration file specified") 0 0 0
1030  
1031 0 ▶ open my $fh, '+>', $local_file or croak "Unable to open local file: $local_file";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "+>", $local_file or croak("Unable to open local file: $local_file") 0 0 0
1032 0 binmode($fh);
1033  
1034 0 while (1) {
1035 0 $data = $self->_request(module => 'System', interface => 'ConfigSync', method => 'download_configuration', data => {config_name => $config_name, chunk_size => $chunk, file_offset => $offset});
1036 0 print $fh $data->{file_data};
1037 0 ▶ last if (($data->{chain_type} eq 'FILE_LAST') or ($data->{chain_type} eq 'FILE_FIRST_AND_LAST'));
Branch: 1 branch
BranchTrueFalseTotal
if $data->{"chain_type"} eq "FILE_LAST" or $data->{"chain_type"} eq "FILE_FIRST_AND_LAST" 0 0 0
Condition0%0/3
$data->{"chain_type"} eq "FILE_LAST" or $data->{"chain_type"} eq "FILE_FIRST_AND_LAST"
l!l&&r!l&&!r
000
MC/DC0%0/2
$data->{"chain_type"} eq "FILE_LAST" or $data->{"chain_type"} eq "FILE_FIRST_AND_LAST"
$data->{"chain_type"} eq "FILE_LAST" $data->{"chain_type"} eq "FILE_FIRST_AND_LAST"
Truth table0%0/3
A or B
A= $data->{"chain_type"} eq "FILE_LAST"B= $data->{"chain_type"} eq "FILE_FIRST_AND_LAST"
ABresult
1X1
011
000
1038 0 $offset+=(length($data->{file_data}));
1039 }
1040  
1041 0 close $fh;
1042 0 return 1
1043 }
1044  
1045 =head3 download_file ( $FILE )
1046  
1047 # Print the bigip.conf file to the terminal
1048 print $ic->download_file('/config/bigip.conf');
1049  
1050 This method provides direct access to files on the target system. The method returns a scalar containing
1051 the contents of the file.
1052  
1053 This method may be useful for downloading configuration files for versioning or backups.
1054  
1055 =cut
1056  
1057 0 ▶sub download_file {
Subroutine download_file: not called CC=4 SCAR=30.0
Pod documented
1058 0 my ($self,$file_name) = @_;
1059 0 my $chunk = 65536;
1060 0 my $offset = 0;
1061 0 my ($data, $output);
1062  
1063 0 ▶ $file_name or croak 'No file name specified';
Branch: 1 branch
BranchTrueFalseTotal
$file_name or croak("No file name specified") 0 0 0
1064  
1065 0 while (1) {
1066 0 $data = $self->_request(module => 'System', interface => 'ConfigSync', method => 'download_file', data => {file_name => $file_name, chunk_size => $chunk, file_offset => $offset});
1067 0 $output .=$data->{file_data};
1068 0 ▶ last if (($data->{chain_type} eq 'FILE_LAST') or ($data->{chain_type} eq 'FILE_FIRST_AND_LAST'));
Branch: 1 branch
BranchTrueFalseTotal
if $data->{"chain_type"} eq "FILE_LAST" or $data->{"chain_type"} eq "FILE_FIRST_AND_LAST" 0 0 0
Condition0%0/3
$data->{"chain_type"} eq "FILE_LAST" or $data->{"chain_type"} eq "FILE_FIRST_AND_LAST"
l!l&&r!l&&!r
000
MC/DC0%0/2
$data->{"chain_type"} eq "FILE_LAST" or $data->{"chain_type"} eq "FILE_FIRST_AND_LAST"
$data->{"chain_type"} eq "FILE_LAST" $data->{"chain_type"} eq "FILE_FIRST_AND_LAST"
Truth table0%0/3
A or B
A= $data->{"chain_type"} eq "FILE_LAST"B= $data->{"chain_type"} eq "FILE_FIRST_AND_LAST"
ABresult
1X1
011
000
1069 0 $offset+=(length($data->{file_data}));
1070 }
1071  
1072 0 return $output
1073 }
1074  
1075 =head3 get_interface_list ()
1076  
1077 my @interfaces = $ic->get_interface_list();
1078  
1079 Retuns an ordered list of all interfaces on the target device.
1080  
1081 =cut
1082  
1083 0 ▶sub get_interface_list {
Subroutine get_interface_list: not called CC=1 SCAR=6.9
Pod documented
1084 0 return sort @{$_[0]->_request(module => 'Networking', interface => 'Interfaces', method => 'get_list')};
1085 }
1086  
1087 =head3 get_interface_enabled_state ($interface)
1088  
1089 Returns the enabled state of the specific interface.
1090  
1091 =cut
1092  
1093 0 ▶sub get_interface_enabled_state {
Subroutine get_interface_enabled_state: not called CC=1 SCAR=6.9
Pod documented
1094 0 my ($self, $inet)=@_;
1095 0 return @{$self->_request(module => 'Networking', interface => 'Interfaces', method => 'get_enabled_state', data => { interfaces => [$inet] })}[0]
1096 }
1097  
1098 =head3 get_interface_media_status ($interface)
1099  
1100 Returns the media status of the specific interface.
1101  
1102 =cut
1103  
1104 0 ▶sub get_interface_media_status {
Subroutine get_interface_media_status: not called CC=1 SCAR=6.9
Pod documented
1105 0 my ($self, $inet)=@_;
1106 0 return @{$self->_request(module => 'Networking', interface => 'Interfaces', method => 'get_media_status', data => { interfaces => [$inet] })}[0]
1107 }
1108  
1109 =head3 get_interface_media_speed ($interface)
1110  
1111 Returns the media speed of the specific interface in Mbps.
1112  
1113 =cut
1114  
1115 0 ▶sub get_interface_media_speed {
Subroutine get_interface_media_speed: not called CC=1 SCAR=6.9
Pod documented
1116 0 my ($self, $inet)=@_;
1117 0 return @{$self->_request(module => 'Networking', interface => 'Interfaces', method => 'get_media_speed', data => { interfaces => [$inet] })}[0]
1118 }
1119  
1120 =head3 get_interface_statistics ($interface)
1121  
1122 Returns all statistics for the specified interface as a InterfaceStatistics object. Unless you specifically
1123 require access to the raw object, consider using B<get_interface_statistics_stringified> for a pre-parsed hash
1124 in an easy-to-digest format.
1125  
1126 =cut
1127  
1128 0 ▶sub get_interface_statistics {
Subroutine get_interface_statistics: not called CC=1 SCAR=6.9
Pod documented
1129 0 my ($self, $inet)=@_;
1130 0 return $self->_request(module => 'Networking', interface => 'Interfaces', method => 'get_statistics', data => { interfaces => [$inet] })
1131 }
1132  
1133 =head3 get_interface_statistics_stringified ($interface)
1134  
1135 my $inet = ($ic->get_interface_list())[0];
1136 my %stats = $ic->get_interface_statistics_stringified($inet);
1137  
1138 print "Interface: $inet - Bytes in: $stats{stats}{STATISTIC_BYTES_IN} - Bytes out: STATISTIC_BYTES_OUT";
1139  
1140 Returns all statistics for the specified interface as a hash having the following structure;
1141  
1142 {
1143 timestamp => 'YYYY-MM-DD-hh-mm-ss',
1144 stats => {
1145 statistic_1 => value
1146 ...
1147 statistic_n => value
1148 }
1149 }
1150  
1151 Where the keys of the stats hash are the names of the statistic types defined in a InterfaceStatistics object.
1152 Refer to the official API documentation for the exact structure of the InterfaceStatistics object.
1153  
1154 =cut
1155  
1156 0 ▶sub get_interface_statistics_stringified {
Subroutine get_interface_statistics_stringified: not called CC=1 SCAR=6.9
Pod documented
1157 0 my ($self, $inet)=@_;
1158 0 return __process_statistics($self->get_interface_statistics($inet))
1159 }
1160  
1161 =head3 get_trunk_list ()
1162  
1163 my @trunks = $ic->get_trunk_list();
1164  
1165 Returns an array of the configured trunks present on the device.
1166  
1167 =cut
1168  
1169 0 ▶sub get_trunk_list {
Subroutine get_trunk_list: not called CC=1 SCAR=6.9
Pod documented
1170 0 return @{$_[0]->_request(module => 'Networking', interface => 'Trunk', method => 'get_list')};
1171 }
1172  
1173 =head3 get_active_trunk_members ()
1174  
1175 print "Trunk $t has " . $ic->get_active_trunk_members() . " active members.\n";
1176  
1177 Returns the number of the active members for the specified trunk.
1178  
1179 =cut
1180  
1181 0 ▶sub get_active_trunk_members {
Subroutine get_active_trunk_members: not called CC=1 SCAR=6.9
Pod documented
1182 0 my ($self, $trunk) = @_;
1183 0 return @{$_[0]->_request(module => 'Networking', interface => 'Trunk', method => 'get_operational_member_count', data => { trunks => [ $trunk ] })}[0]
1184 }
1185  
1186 =head3 get_configured_trunk_members ()
1187  
1188 print "Trunk $t has " . $ic->get_configured_trunk_members() . " configured members.\n";
1189  
1190 Returns the number of configured members for the specified trunk.
1191  
1192 =cut
1193  
1194 0 ▶sub get_configured_trunk_members {
Subroutine get_configured_trunk_members: not called CC=1 SCAR=6.9
Pod documented
1195 0 my ($self, $trunk) = @_;
1196 0 return @{$_[0]->_request(module => 'Networking', interface => 'Trunk', method => 'get_configured_member_count', data => { trunks => [ $trunk ] })}[0]
1197 }
1198  
1199 =head3 get_trunk_interfaces ()
1200  
1201 my @t_inets = $ic->get_trunk_interfaces();
1202  
1203 Returns an array containing the interfaces of the members of the specified trunk.
1204  
1205 =cut
1206  
1207 0 ▶sub get_trunk_interfaces {
Subroutine get_trunk_interfaces: not called CC=1 SCAR=6.9
Pod documented
1208 0 my ($self, $trunk) = @_;
1209 0 return @{@{$_[0]->_request(module => 'Networking', interface => 'Trunk', method => 'get_interface', data => { trunks => [ $trunk ] })}[0]}
1210 }
1211  
1212 =head3 get_trunk_media_speed ()
1213  
1214 print "Trunk $t operating at " . $ic->get_trunk_media_speed($t) . "Mbps\n";
1215  
1216 Returns the current operational media speed (in Mbps) of the specified trunk.
1217  
1218 =cut
1219  
1220 0 ▶sub get_trunk_media_speed {
Subroutine get_trunk_media_speed: not called CC=1 SCAR=6.9
Pod documented
1221 0 my ($self, $trunk) = @_;
1222 0 return @{$_[0]->_request(module => 'Networking', interface => 'Trunk', method => 'get_media_speed', data => { trunks => [ $trunk ] })}[0]
1223 }
1224  
1225 =head3 get_trunk_media_status ()
1226  
1227 print "Trunk $t media status is " . $ic->get_trunk_media_status($t) . "\n";
1228  
1229 Returns the current operational media status of the specified trunk.
1230  
1231 =cut
1232  
1233 0 ▶sub get_trunk_media_status {
Subroutine get_trunk_media_status: not called CC=1 SCAR=6.9
Pod documented
1234 0 my ($self, $trunk) = @_;
1235 0 return @{$_[0]->_request(module => 'Networking', interface => 'Trunk', method => 'get_media_status', data => { trunks => [ $trunk ] })}[0]
1236 }
1237  
1238 =head3 get_trunk_lacp_enabled_state ()
1239  
1240 Returns the enabled state of LACP for the specified trunk.
1241  
1242 =cut
1243  
1244 0 ▶sub get_trunk_lacp_enabled_state {
Subroutine get_trunk_lacp_enabled_state: not called CC=1 SCAR=6.9
Pod documented
1245 0 my ($self, $trunk) = @_;
1246 0 return @{$_[0]->_request(module => 'Networking', interface => 'Trunk', method => 'get_lacp_enabled_state', data => { trunks => [ $trunk ] })}[0]
1247 }
1248  
1249 =head3 get_trunk_lacp_active_state ()
1250  
1251 Returns the active state of LACP for the specified trunk.
1252  
1253 =cut
1254  
1255 0 ▶sub get_trunk_lacp_active_state {
Subroutine get_trunk_lacp_active_state: not called CC=1 SCAR=6.9
Pod documented
1256 0 my ($self, $trunk) = @_;
1257 0 return @{$_[0]->_request(module => 'Networking', interface => 'Trunk', method => 'get_active_lacp_state', data => { trunks => [ $trunk ] })}[0]
1258 }
1259  
1260 =head3 get_trunk_statistics ()
1261  
1262 Returns the traffic statistics for the specified trunk. The statistics are returned as a TrunkStatistics object
1263 hence this method is useful where access to raw statistical data is required.
1264  
1265 For parsed statistic data, see B<get_trunk_statistics_stringified>.
1266  
1267 For specific information regarding data and units of measurement for statistics methods, please see the B<Notes> section.
1268  
1269 =cut
1270  
1271 0 ▶sub get_trunk_statistics {
Subroutine get_trunk_statistics: not called CC=1 SCAR=6.9
Pod documented
1272 0 my ($self, $trunk) = @_;
1273 0 return $self->_request(module => 'Networking', interface => 'Trunk', method => 'get_statistics', data => { trunks => [ $trunk ] })
1274 }
1275  
1276 =head3 get_trunk_statistics_stringified ()
1277  
1278 Returns all statistics for the specified trunk as a hash of hases with the following structure:
1279  
1280 {
1281 timestamp => 'yyyy-mm-dd-hh-mm-ss',
1282 stats => {
1283 stats_1 => value,
1284 stats_3 => value,
1285 ...
1286 stats_n => value
1287 }
1288 }
1289
1290 This function accepts a single parameter; the trunk for which the statistics are to be returned.
1291  
1292 For specific information regarding data and units of measurement for statistics methods, please see the B<Notes> section.
1293  
1294 =cut
1295  
1296 0 ▶sub get_trunk_statistics_stringified {
Subroutine get_trunk_statistics_stringified: not called CC=1 SCAR=6.9
Pod documented
1297 0 my ($self, $trunk) = @_;
1298 0 return __process_statistics($self->get_trunk_statistics($trunk))
1299 }
1300  
1301 =head3 get_self_ip_list
1302  
1303 Returns a list of all self IP addresses on the target device.
1304  
1305 =cut
1306  
1307 0 ▶sub get_self_ip_list {
Subroutine get_self_ip_list: not called CC=1 SCAR=6.9
Pod documented
1308 0 return @{$_[0]->_request(module => 'Networking', interface => 'SelfIP', method => 'get_list')}
1309 }
1310  
1311 =head3 get_self_ip_vlan ( $SELF_IP )
1312  
1313 Returns the VLAN associated with the specified self IP address on the target device.
1314  
1315 =cut
1316  
1317 0 ▶sub get_self_ip_vlan {
Subroutine get_self_ip_vlan: not called CC=1 SCAR=6.9
Pod documented
1318 0 my ($self, $ip) = @_;
1319 0 return @{$self->_request(module => 'Networking', interface => 'SelfIP', method => 'get_vlan', data => { self_ips => [ $ip ] })}[0]
1320 }
1321  
1322 =head3 get_vs_list ()
1323  
1324 my @virtuals = $ic->get_vs_list();
1325  
1326 B<Please note>: this method has been deprecated in future releases. Please use get_ltm_vs_list instead.
1327  
1328 Returns an array of all defined LTM virtual servers.
1329  
1330 =cut
1331  
1332 0 ▶sub get_vs_list {
Subroutine get_vs_list: not called CC=1 SCAR=6.9
Pod documented
1333 0 return $_[0]->get_ltm_vs_list()
1334 }
1335  
1336 =head3 get_ltm_vs_list ()
1337  
1338 my @ltm_virtuals = $ic->get_ltm_vs_list();
1339  
1340 Returns an array of all defined LTM virtual servers.
1341  
1342 =cut
1343  
1344 0 ▶sub get_ltm_vs_list {
Subroutine get_ltm_vs_list: not called CC=1 SCAR=6.9
Pod documented
1345 0 return @{$_[0]->_request(module => 'LocalLB', interface => 'VirtualServer', method => 'get_list')};
1346 }
1347  
1348 =head3 get_gtm_vs_list ()
1349  
1350 my @gtm_virtuals = $ic->get_gtm_vs_list();
1351  
1352 Returns an array of the names of all defined GTM virtual servers.
1353  
1354 =cut
1355  
1356 0 ▶sub get_gtm_vs_list {
Subroutine get_gtm_vs_list: not called CC=2 SCAR=17.9
Pod documented
1357 0 my @members;
1358 0 foreach (@{$_[0]->_request(module => 'GlobalLB', interface => 'VirtualServer', method => 'get_list')}) {
1359 push @members, $_->{name}
1360 0 }
1361 return @members
1362 0 }
1363  
1364  
1365 =head3 get_vs_destination ($virtual_server)
1366  
1367 my $destination = $ic->get_vs_destination($vs);
1368  
1369 Returns the destination of the specified virtual server in the form ipv4_address%route_domain:port.
1370  
1371 =cut
1372  
1373 0 ▶sub get_vs_destination {
Subroutine get_vs_destination: not called CC=1 SCAR=6.9
Pod documented
1374 0 my ($self, $vs) = @_;
1375 0 my $destination = @{$self->_request(module => 'LocalLB', interface => 'VirtualServer', method => 'get_destination', data => {virtual_servers => [$vs]})}[0];
1376 return $destination->{address}.':'.$destination->{port}
1377 0 }
1378  
1379 =head3 get_vs_enabled_state ($virtual_server)
1380  
1381 print "LTM Virtual server $vs is in state ",$ic->get_vs_enabled_state($vs),"\n";
1382  
1383 B<Please note>: this method has been deprecated in future releases. Please use the B<get_ltm_vs_enabled_state()> instead.
1384  
1385 Return the enabled state of the specified LTM virtual server.
1386  
1387 =cut
1388  
1389 0 ▶sub get_vs_enabled_state {
Subroutine get_vs_enabled_state: not called CC=1 SCAR=6.9
Pod documented
1390 0 my ($self, $vs) = @_;
1391 0 return $self->get_ltm_vs_enabled_state($vs)
1392 }
1393  
1394 =head3 get_ltm_vs_enabled_state ($virtual_server)
1395  
1396 print "LTM Virtual server $vs is in state ",$ic->get_ltm_vs_enabled_state($vs),"\n";
1397  
1398 Return the enabled state of the specified LTM virtual server.
1399  
1400 =cut
1401  
1402 0 ▶sub get_ltm_vs_enabled_state {
Subroutine get_ltm_vs_enabled_state: not called CC=1 SCAR=6.9
Pod documented
1403 0 my ($self, $vs) = @_;
1404 0 return @{$self->_request(module => 'LocalLB', interface => 'VirtualServer', method => 'get_enabled_state', data => {virtual_servers => [$vs]})}[0];
1405 }
1406  
1407 =head3 get_gtm_vs_enabled_state ($virtual_server)
1408  
1409 print "GTM Virtual server $vs is in state ",$ic->get_gtm_vs_enabled_state($vs),"\n";
1410  
1411 Return the enabled state of the specified GTM virtual server. The GTM server should be provided as a name only such as that
1412 returned from the B<get_gtm_vs_list> method.
1413  
1414 =cut
1415  
1416 0 ▶sub get_gtm_vs_enabled_state {
Subroutine get_gtm_vs_enabled_state: not called CC=1 SCAR=6.9
Pod documented
1417 0 my ($self, $vs) = @_;
1418 0 my %def = $self->__get_gtm_vs_definition($vs);
1419 0 return @{$self->_request(module => 'GlobalLB', interface => 'VirtualServer', method => 'get_enabled_state', data => {virtual_servers => [{%def}]})}[0];
1420 }
1421  
1422 =head3 get_vs_all_statistics ()
1423  
1424 B<Please Note>: This method has been deprecated in future releases. Please use B<get_ltm_vs_all_statistics>.
1425  
1426 Returns the traffic statistics for all configured LTM virtual servers. The statistics are returned as
1427 VirtualServerStatistics struct hence this method is useful where access to raw statistical data is required.
1428  
1429 For parsed statistic data, see B<get_ltm_vs_statistics_stringified>.
1430  
1431 For specific information regarding data and units of measurement for statistics methods, please see the B<Notes> section.
1432  
1433 =cut
1434  
1435 0 ▶sub get_vs_all_statistics {
Subroutine get_vs_all_statistics: not called CC=1 SCAR=6.9
Pod documented
1436 0 return $_[0]->get_ltm_vs_all_statistics()
1437 #return $self->_request(module => 'LocalLB', interface => 'VirtualServer', method => 'get_all_statistics');
1438 }
1439  
1440 =head3 get_ltm_vs_all_statistics ()
1441  
1442 Returns the traffic statistics for all configured LTM virtual servers. The statistics are returned as
1443 VirtualServerStatistics struct hence this method is useful where access to raw statistical data is required.
1444  
1445 For parsed statistic data, see B<get_ltm_vs_statistics_stringified>.
1446  
1447 For specific information regarding data and units of measurement for statistics methods, please see the B<Notes> section.
1448  
1449 =cut
1450  
1451 0 ▶sub get_ltm_vs_all_statistics {
Subroutine get_ltm_vs_all_statistics: not called CC=1 SCAR=6.9
Pod documented
1452 0 return $_[0]->_request(module => 'LocalLB', interface => 'VirtualServer', method => 'get_all_statistics');
1453 }
1454  
1455 =head3 get_vs_statistics ($virtual_server)
1456  
1457 my $statistics = $ic->get_vs_statistics($vs);
1458  
1459 Returns all statistics for the specified virtual server as a VirtualServerStatistics object. Consider using get_vs_statistics_stringified
1460 for accessing virtual server statistics in a pre-parsed hash structure.
1461  
1462 For specific information regarding data and units of measurement for statistics methods, please see the B<Notes> section.
1463  
1464 =cut
1465  
1466 0 ▶sub get_vs_statistics {
Subroutine get_vs_statistics: not called CC=1 SCAR=6.9
Pod documented
1467 0 my ($self, $vs) = @_;
1468 0 return $self->_request(module => 'LocalLB', interface => 'VirtualServer', method => 'get_statistics', data => {virtual_servers => [$vs]});
1469 }
1470  
1471 =head3 get_vs_statistics_stringified ($virtual_server)
1472  
1473 my $statistics = $ic->get_vs_statistics_stringified($vs);
1474  
1475 foreach (sort keys %{$stats{stats}}) {
1476 print "$_: $stats{stats}{$_}\n";
1477 }
1478  
1479 Returns all statistics for the specified virtual server as a multidimensional hash (hash of hashes). The hash has the following structure:
1480  
1481 {
1482 timestamp => 'yyyy-mm-dd-hh-mm-ss',
1483 stats => {
1484 statistic_1 => value,
1485 statistic_2 => value,
1486 ...
1487 statistic_n => value
1488 }
1489 }
1490  
1491 This function accepts a single parameter; the virtual server for which the statistics are to be returned.
1492  
1493 For specific information regarding data and units of measurement for statistics methods, please see the B<Notes> section.
1494  
1495 =cut
1496  
1497 0 ▶sub get_vs_statistics_stringified {
Subroutine get_vs_statistics_stringified: not called CC=1 SCAR=6.9
Pod documented
1498 0 my ($self, $vs) = @_;
1499 0 return __process_statistics($self->get_vs_statistics($vs));
1500 }
1501  
1502 =head3 get_ltm_vs_rules ($virtual_server)
1503  
1504 =cut
1505  
1506 0 ▶sub get_ltm_vs_rules {
Subroutine get_ltm_vs_rules: not called CC=1 SCAR=6.9
Pod documented
1507 0 my ($self, $vs) = @_;
1508 0 return map { $_->[1] }
1509 0 sort { $a->[0] <=> $b->[0] }
1510 0 map { [ $_->{priority}, $_->{rule_name} ] }
1511 0 @{@{$self->_request(module => 'LocalLB', interface => 'VirtualServer', method => 'get_rule', data => {virtual_servers => [$vs]})}[0]}
1512 }
1513  
1514 =head3 get_ltm_snat_pool ($virtual_server)
1515  
1516 =cut
1517  
1518 0 ▶sub get_ltm_snat_pool {
Subroutine get_ltm_snat_pool: not called CC=1 SCAR=6.9
Pod documented
1519 0 my($self, $vs) = @_;
1520 0 return @{$self->_request(module => 'LocalLB', interface => 'VirtualServer', method => 'get_snat_pool', data => {virtual_servers => [$vs]})}[0]
1521 }
1522  
1523 =head3 get_ltm_snat_type ($virtual_server)
1524  
1525 =cut
1526  
1527 0 ▶sub get_ltm_snat_type {
Subroutine get_ltm_snat_type: not called CC=1 SCAR=6.9
Pod documented
1528 0 my($self, $vs) = @_;
1529 0 return @{$self->_request(module => 'LocalLB', interface => 'VirtualServer', method => 'get_snat_type', data => {virtual_servers => [$vs]})}[0]
1530 }
1531  
1532 =head3 get_default_pool_name ($virtual_server)
1533  
1534 print "Virtual Server: $virtual_server\nDefault Pool: ",
1535 $ic->get_default_pool_name($virtual_server), "\n";
1536  
1537 Returns the default pool names for the specified virtual server.
1538  
1539 =cut
1540  
1541 0 ▶sub get_default_pool_name {
Subroutine get_default_pool_name: not called CC=1 SCAR=6.9
Pod documented
1542 0 my ($self, $vs)=@_;
1543 0 return @{$self->_request(module => 'LocalLB', interface => 'VirtualServer', method => 'get_default_pool_name', data => {virtual_servers => [$vs]})}[0]
1544 }
1545  
1546 =head3 get_pool_list ()
1547  
1548 print join " ", ($ic->get_pool_list());
1549  
1550 Returns a list of all LTM pools in the target system.
1551  
1552 Note that this method has been deprecated in future releases - please use B<get_ltm_vs_list> instead.
1553  
1554 =cut
1555  
1556 0 ▶sub get_pool_list {
Subroutine get_pool_list: not called CC=1 SCAR=6.9
Pod documented
1557 0 return $_[0]->get_ltm_pool_list()
1558 #return @{$_[0]->_request(module => 'LocalLB', interface => 'Pool', method => 'get_list')};
1559 }
1560  
1561 =head3 get_ltm_pool_list ()
1562  
1563 print join " ", ($ic->get_ltm_pool_list());
1564  
1565 Returns a list of all LTM pools in the target system.
1566  
1567 =cut
1568  
1569 0 ▶sub get_ltm_pool_list {
Subroutine get_ltm_pool_list: not called CC=1 SCAR=6.9
Pod documented
1570 0 return @{$_[0]->_request(module => 'LocalLB', interface => 'Pool', method => 'get_list')};
1571 }
1572  
1573  
1574 =head3 get_pool_members ($pool)
1575  
1576 foreach my $pool ($ic->get_pool_list()) {
1577 print "\n\n$pool:\n";
1578  
1579 foreach my $member ($ic->get_pool_members($pool)) {
1580 print "\t$member\n";
1581 }
1582 }
1583  
1584 B<Please note>: this method has been deprecated in future releases. Please use the B<get_ltm_pool_members> method instead.
1585  
1586 Returns a list of the pool members for the specified LTM pool. This method takes one mandatory parameter; the name of the pool.
1587  
1588 Pool member are returned in the format B<IP_address:service_port>.
1589  
1590 =cut
1591  
1592 0 ▶sub get_pool_members {
Subroutine get_pool_members: not called CC=1 SCAR=6.9
Pod documented
1593 0 my ($self, $pool)=@_;
1594 0 return $self->get_ltm_pool_members($pool)
1595 #my ($self, $pool)= @_;
1596 #my @members;
1597 #foreach (@{@{$self->__get_pool_members($pool,$module)}[0]}) {push @members, ($_->{address}.':'.$_->{port})}
1598 #return @members;
1599 }
1600  
1601 =head3 get_ltm_pool_members ($pool)
1602  
1603 foreach my $pool ($ic->get_ltm_pool_list()) {
1604 print "\n\n$pool:\n";
1605  
1606 foreach my $member ($ic->get_ltm_pool_members($pool)) {
1607 print "\t$member\n";
1608 }
1609 }
1610  
1611 Returns a list of the pool members for the specified LTM pool. This method takes one mandatory parameter; the name of the pool.
1612  
1613 Pool member are returned in the format B<IP_address:service_port>.
1614  
1615 =cut
1616  
1617 0 ▶sub get_ltm_pool_members {
Subroutine get_ltm_pool_members: not called CC=2 SCAR=17.9
Pod documented
1618 0 my ($self, $pool)= @_;
1619 0 my @members;
1620 0 foreach (@{@{$self->__get_pool_members($pool,'LocalLB')}[0]}) {push @members, ($_->{address}.':'.$_->{port})}
1621 0 return @members;
1622 }
1623  
1624 =head3 get_gtm_pool_members ($pool)
1625  
1626 Returns a list of the pool members for the specified GTM pool. This method takes one mandatory parameter; the name of the pool.
1627  
1628 Pool member are returned in the format B<IP_address:service_port>.
1629  
1630 =cut
1631  
1632 0 ▶sub get_gtm_pool_members {
Subroutine get_gtm_pool_members: not called CC=2 SCAR=17.9
Pod documented
1633 0 my ($self,$pool)=@_;
1634 0 my @members;
1635 0 foreach (@{@{$self->__get_pool_members($pool,'GlobalLB')}[0]}) {push @members, $_->{member}->{address}.':'.$_->{member}->{port}}
1636 return @members
1637 0 }
1638  
1639 0 ▶sub __get_pool_members {
Subroutine __get_pool_members: not called CC=1 SCAR=6.9
1640 0 my ($self, $pool, $module)= @_;
1641 0 return $self->_request(module => $module, interface => 'Pool', method => 'get_member', data => {pool_names => [$pool]});
1642 }
1643  
1644 =head3 get_pool_statistics ($pool)
1645  
1646 my %stats = $ic->get_pool_statistics($pool);
1647  
1648 Returns the statistics for the specified pool as a PoolStatistics object. For pre-parsed pool statistics consider using
1649 the B<get_pool_statistics_stringified> method.
1650  
1651 =cut
1652  
1653 0 ▶sub get_pool_statistics {
Subroutine get_pool_statistics: not called CC=1 SCAR=6.9
Pod documented
1654 0 my ($self, $pool)= @_;
1655 0 return $self->_request(module => 'LocalLB', interface => 'Pool', method => 'get_statistics', data => {pool_names => [$pool]});
1656 }
1657  
1658 =head3 get_pool_statistics_stringified ($pool)
1659  
1660 my %stats = $ic->get_pool_statistics_stringified($pool);
1661 print "Pool $pool bytes in: $stats{stat}{STATISTIC_SERVER_SIDE_BYTES_OUT}";
1662  
1663 Returns a hash containing all pool statistics for the specified pool in a delicious, easily digestable and improved formula.
1664  
1665 =cut
1666  
1667 0 ▶sub get_pool_statistics_stringified {
Subroutine get_pool_statistics_stringified: not called CC=1 SCAR=6.9
Pod documented
1668 0 my ($self, $pool)= @_;
1669 0 return __process_statistics($self->get_pool_statistics($pool));
1670 }
1671  
1672 =head3 get_pool_member_statistics ($pool)
1673  
1674 Returns all pool member statistics for the specified pool as an array of MemberStatistics objects. Unless you feel like
1675 playing with Data::Dumper on a rainy Sunday afternoon, consider using B<get_pool_member_statistics_stringified> method.
1676  
1677 =cut
1678  
1679 0 ▶sub get_pool_member_statistics {
Subroutine get_pool_member_statistics: not called CC=1 SCAR=6.9
Pod documented
1680 0 my ($self, $pool)= @_;
1681
1682 0 return $self->_request(module => 'LocalLB', interface => 'PoolMember', method => 'get_statistics', data => {
1683 pool_names => [$pool],
1684 members => $self->__get_pool_members($pool,'LocalLB') });
1685 }
1686  
1687 =head3 get_pool_member_object_status ($pool)
1688  
1689 Returns all pool member stati for the specified pool as an array of MemberObjectStatus objects.
1690  
1691 =cut
1692  
1693 0 ▶sub get_pool_member_object_status {
Subroutine get_pool_member_object_status: not called CC=1 SCAR=6.9
Pod documented
1694 0 my ($self, $pool) = @_;
1695  
1696 0 return $self->_request(module => 'LocalLB', interface => 'PoolMember', method => 'get_object_status', data => {
1697 pool_names => [$pool],
1698 });
1699 }
1700  
1701  
1702 =head3 get_pool_member_statistics_stringified ($pool)
1703  
1704 my %stats = $ic->get_pool_member_statistics_stringified($pool);
1705  
1706 print "Member\t\t\t\tRequests\n",'-'x5,"\t\t\t\t",'-'x5,"\n";
1707
1708 foreach my $member (sort keys %stats) {
1709 print "$member\t\t$stats{$member}{stats}{STATISTIC_TOTAL_REQUESTS}\n";
1710 }
1711  
1712 # Prints a list of requests per pool member
1713  
1714 Returns a hash containing all pool member statistics for the specified pool. The hash has the following
1715 structure;
1716  
1717 member_1 => {
1718 timestamp => 'YYYY-MM-DD-hh-mm-ss',
1719 stats => {
1720 statistics_1 => value
1721 ...
1722 statistic_n => value
1723 }
1724 }
1725 member_2 => {
1726 ...
1727 }
1728 member_n => {
1729 ...
1730 }
1731  
1732 Each pool member is specified in the form ipv4_address%route_domain:port.
1733  
1734 =cut
1735  
1736 0 ▶sub get_pool_member_statistics_stringified {
Subroutine get_pool_member_statistics_stringified: not called CC=1 SCAR=6.9
Pod documented
1737 0 my ($self, $pool)= @_;
1738 0 return __process_pool_member_statistics($self->get_pool_member_statistics($pool))
1739 }
1740  
1741 =head3 get_all_pool_member_statistics ($pool)
1742  
1743 Returns all pool member statistics for the specified pool. This method is analogous to the B<get_pool_member_statistics()>
1744 method and the two will likely be merged in a future release.
1745  
1746 =cut
1747  
1748 0 ▶sub get_all_pool_member_statistics {
Subroutine get_all_pool_member_statistics: not called CC=1 SCAR=6.9
Pod documented
1749 0 my ($self, $pool)= @_;
1750 0 return $self->_request(module => 'LocalLB', interface => 'PoolMember', method => 'get_all_statistics', data => {pool_names => [$pool]});
1751 }
1752  
1753 =head3 get_ltm_pool_status ($pool)
1754  
1755 Returns the status of the specified pool as a ObjectStatus object.
1756  
1757 For formatted pool status information, see the B<get_ltm_pool_status_as_string()> method.
1758  
1759 =cut
1760  
1761 0 ▶sub get_ltm_pool_status {
Subroutine get_ltm_pool_status: not called CC=1 SCAR=6.9
Pod documented
1762 0 my ($self, $pool)= @_;
1763 0 return @{$self->_request(module => 'LocalLB', interface => 'Pool', method => 'get_object_status', data => {pool_names => [$pool]})}[0]
1764 }
1765  
1766 =head3 get_ltm_pool_member_status ($pool, $member)
1767  
1768 Returns the status of the specified member in the specified pool as a ObjectStatus object.
1769  
1770 =cut
1771  
1772 0 ▶sub get_ltm_pool_member_status {
Subroutine get_ltm_pool_member_status: not called CC=1 SCAR=6.9
Pod documented
1773 0 my ($self, $pool, $member) = @_;
1774 0 return @{$self->_request(module => 'LocalLB', interface => 'Pool', method => 'get_member_object_status', data => {
1775 pool_names => [$pool],
1776 members => [$member],
1777 })}[0];
1778 }
1779  
1780 =head3 get_ltm_pool_availability_status ($pool)
1781  
1782 Retuns the availability status of the specified pool.
1783  
1784 =cut
1785  
1786 0 ▶sub get_ltm_pool_availability_status {
Subroutine get_ltm_pool_availability_status: not called CC=1 SCAR=6.9
Pod documented
1787 0 my ($self, $pool)= @_;
1788 0 return $self->get_ltm_pool_status_as_string($pool,'availability_status');
1789 }
1790  
1791 =head3 get_ltm_pool_enabled_status ($pool)
1792  
1793 Retuns the enabled status of the specified pool.
1794  
1795 =cut
1796  
1797 0 ▶sub get_ltm_pool_enabled_status {
Subroutine get_ltm_pool_enabled_status: not called CC=1 SCAR=6.9
Pod documented
1798 0 my ($self, $pool)= @_;
1799 0 return $self->get_ltm_pool_status_as_string($pool,'enabled_status');
1800 }
1801  
1802 =head3 get_ltm_pool_status_description ($pool)
1803  
1804 Returns a descriptive status of the specified pool.
1805  
1806 =cut
1807  
1808 0 ▶sub get_ltm_pool_status_description {
Subroutine get_ltm_pool_status_description: not called CC=1 SCAR=6.9
Pod documented
1809 0 my ($self, $pool)= @_;
1810 0 return $self->get_ltm_pool_status_as_string($pool,'status_description');
1811 }
1812  
1813 =head3 get_ltm_pool_status_as_string ($pool)
1814  
1815 Returns the pool status as a descriptive string.
1816  
1817 =cut
1818  
1819 0 ▶sub get_ltm_pool_status_as_string {
Subroutine get_ltm_pool_status_as_string: not called CC=2 SCAR=17.9
Pod documented
1820 0 my ($self, $pool, $status_key)= @_;
1821
1822 0 ▶ $status_key or ($status_key = 'status_description');
Branch: 1 branch
BranchTrueFalseTotal
$status_key or $status_key = "status_description" 0 0 0
1823
1824 0 return $self->get_ltm_pool_status($pool)->{$status_key};
1825 }
1826  
1827 0 ▶sub _get_ltm_pool_member_oject_status {
Subroutine _get_ltm_pool_member_oject_status: not called CC=1 SCAR=6.9
1828 0 my ($self, $pool)
1829 }
1830  
1831 =head3 get_connection_list ()
1832  
1833 Returns a list of active connections as a list of ConnectionID objects.
1834  
1835 =cut
1836  
1837 0 ▶sub get_connection_list {
Subroutine get_connection_list: not called CC=1 SCAR=6.9
Pod documented
1838 0 return $_[0]->_request(module => 'System', interface => 'Connections', method => 'get_list');
1839 }
1840  
1841 =head3 get_all_active_connections ()
1842  
1843 Gets all active connections in details on the device.
1844  
1845 =cut
1846  
1847 0 ▶sub get_all_active_connections {
Subroutine get_all_active_connections: not called CC=1 SCAR=6.9
Pod documented
1848 0 return $_[0]->_request(module => 'System', interface => 'Connections', method => 'get_all_active_connections');
1849 }
1850  
1851 =head3 get_active_connections_count()
1852  
1853 Returns the number of all active connections on the device.
1854  
1855 =cut
1856  
1857 0 ▶sub get_active_connections_count {
Subroutine get_active_connections_count: not called CC=1 SCAR=6.9
Pod documented
1858 0 return scalar @{$_[0]->get_all_active_connections()}
1859 }
1860  
1861 =head3 get_node_list ()
1862  
1863 print join "\n", ($ic->get_node_list());
1864  
1865 Returns a list of all configured nodes in the target system.
1866  
1867 Nodes are returned as ipv4 addresses.
1868  
1869 =cut
1870  
1871 0 ▶sub get_node_list {
Subroutine get_node_list: not called CC=1 SCAR=6.9
Pod documented
1872 0 return @{$_[0]->_request(module => 'LocalLB', interface => 'NodeAddress', method => 'get_list')}
1873 }
1874  
1875 =head3 get_screen_name ($node)
1876  
1877 foreach ($ic->get_node_list()) {
1878 print "Node: $_ (" . $ic->get_screen_name($_) . ")\n";
1879 }
1880  
1881 Retuns the screen name of the specified node.
1882  
1883 =cut
1884  
1885 0 ▶sub get_screen_name {
Subroutine get_screen_name: not called CC=1 SCAR=6.9
Pod documented
1886 0 my ($self, $node)= @_;
1887 0 return @{$self->_request(module => 'LocalLB', interface => 'NodeAddress', method => 'get_screen_name', data => {node_addresses => [$node]})}[0]
1888 }
1889  
1890 =head3 get_node_status ($node)
1891  
1892 $ic->get_node_status(
1893  
1894 Returns the status of the specified node as a ObjectStatus object.
1895  
1896 For formatted node status information, see the B<get_node_status_as_string()> method.
1897  
1898 =cut
1899  
1900 0 ▶sub get_node_status {
Subroutine get_node_status: not called CC=1 SCAR=6.9
Pod documented
1901 0 my ($self, $node)= @_;
1902 0 return @{$self->_request(module => 'LocalLB', interface => 'NodeAddress', method => 'get_object_status', data => {node_addresses => [$node]})}[0]
1903 }
1904  
1905 =head3 get_node_availability_status ($node)
1906  
1907 Retuns the availability status of the node.
1908  
1909 =cut
1910  
1911 0 ▶sub get_node_availability_status {
Subroutine get_node_availability_status: not called CC=1 SCAR=6.9
Pod documented
1912 0 my ($self, $node)= @_;
1913 0 return $self->get_node_status_as_string($node,'availability_status');
1914 }
1915  
1916 =head3 get_node_enabled_status ($node)
1917  
1918 Retuns the enabled status of the node.
1919  
1920 =cut
1921  
1922 0 ▶sub get_node_enabled_status {
Subroutine get_node_enabled_status: not called CC=1 SCAR=6.9
Pod documented
1923 0 my ($self, $node)= @_;
1924 0 return $self->get_node_status_as_string($node,'enabled_status');
1925 }
1926  
1927 =head3 get_node_status_description ($node)
1928  
1929 Returns a descriptive status of the specified node.
1930  
1931 =cut
1932  
1933 0 ▶sub get_node_status_description {
Subroutine get_node_status_description: not called CC=1 SCAR=6.9
Pod documented
1934 0 my ($self, $node)= @_;
1935 0 return $self->get_node_status_as_string($node,'status_description');
1936 }
1937  
1938 =head3 get_node_status_as_string ($node)
1939  
1940 Returns the node status as a descriptive string.
1941  
1942 =cut
1943  
1944 0 ▶sub get_node_status_as_string {
Subroutine get_node_status_as_string: not called CC=2 SCAR=17.9
Pod documented
1945 0 my ($self, $node, $status_key)= @_;
1946
1947 0 ▶ $status_key or ($status_key = 'status_description');
Branch: 1 branch
BranchTrueFalseTotal
$status_key or $status_key = "status_description" 0 0 0
1948
1949 0 return $self->get_node_status($node)->{$status_key};
1950 }
1951  
1952 =head3 get_node_monitor_status ($node)
1953  
1954 Gets the current availability status of the specified node addresses.
1955  
1956 =cut
1957  
1958 0 ▶sub get_node_monitor_status {
Subroutine get_node_monitor_status: not called CC=1 SCAR=6.9
Pod documented
1959 0 my ($self, $node)= @_;
1960 0 return @{$self->_request(module => 'LocalLB', interface => 'NodeAddress', method => 'get_monitor_status', data => {node_addresses => [$node]})}[0];
1961 }
1962  
1963 =head3 get_node_statistics ($node)
1964  
1965 Returns all statistics for the specified node.
1966  
1967 =cut
1968  
1969 0 ▶sub get_node_statistics {
Subroutine get_node_statistics: not called CC=1 SCAR=6.9
Pod documented
1970 0 my ($self, $node)= @_;
1971 0 return $self->_request(module =>'LocalLB', interface => 'NodeAddress', method => 'get_statistics', data => {node_addresses => [$node]})
1972 }
1973  
1974 =head3 get_node_statistics_stringified
1975  
1976 my %stats = $ltm->get_node_statistics_stringified($node);
1977  
1978 foreach (sort keys %{stats{stats}}) {
1979 print "$_:\t$stats{stats}{$_}{high}\t$stats{stats}{$_}{low}\n";
1980 }
1981  
1982 Returns a multidimensional hash containing all current statistics for the specified node. The hash has the following structure:
1983  
1984 {
1985 timestamp => 'yyyy-mm-dd-hh-mm-ss',
1986 stats => {
1987 statistic_1 => value,
1988 statistic_2 => value,
1989 ...
1990 statistic_n => value
1991 }
1992 }
1993  
1994 This function accepts a single parameter; the node for which the statistics are to be returned.
1995  
1996 For specific information regarding data and units of measurement for statistics methods, please see the B<Notes> section.
1997  
1998 =cut
1999  
2000 0 ▶sub get_node_statistics_stringified {
Subroutine get_node_statistics_stringified: not called CC=1 SCAR=6.9
Pod documented
2001 0 my ($self, $node)= @_;
2002 0 return __process_statistics($self->get_node_statistics($node));
2003 }
2004  
2005 =head3 get_gtm_pool_list ()
2006  
2007 Returns a list of GTM pools.
2008  
2009 =cut
2010  
2011 0 ▶sub get_gtm_pool_list {
Subroutine get_gtm_pool_list: not called CC=1 SCAR=6.9
Pod documented
2012 0 return @{$_[0]->_request(module => 'GlobalLB', interface => 'Pool', method => 'get_list')}
2013 }
2014  
2015 =head3 get_gtm_pool_description ()
2016  
2017 Returns a description of the specified GTM pool.
2018  
2019 =cut
2020  
2021 0 ▶sub get_gtm_pool_description {
Subroutine get_gtm_pool_description: not called CC=1 SCAR=6.9
Pod documented
2022 0 my ($self, $pool)=@_;
2023 0 return @{$self->_request(module => 'GlobalLB', interface => 'Pool', method => 'get_description', data => {pool_names => [$pool]})}[0];
2024 }
2025  
2026 =head3 get_gtm_vs_all_statistics ()
2027  
2028 Returns the traffic statistics for all configured GTM virtual servers. The statistics are returned as
2029 VirtualServerStatistics struct hence this method is useful where access to raw statistical data is required.
2030  
2031 For parsed statistic data, see B<get_gtm_vs_statistics_stringified>.
2032  
2033 For specific information regarding data and units of measurement for statistics methods, please see the B<Notes> section.
2034  
2035 =cut
2036  
2037 0 ▶sub get_gtm_vs_all_statistics {
Subroutine get_gtm_vs_all_statistics: not called CC=1 SCAR=6.9
Pod documented
2038 0 return $_[0]->_request(module => 'GlobalLB', interface => 'VirtualServer', method => 'get_all_statistics');
2039 }
2040  
2041 0 ▶sub __get_gtm_vs_definition {
Subroutine __get_gtm_vs_definition: not called CC=3 SCAR=24.8
2042 0 my ($self, $vs)=@_;
2043 0 foreach (@{$self->_request(module => 'GlobalLB', interface => 'VirtualServer', method => 'get_list')}) {
2044 0 ▶ return %{$_} if ($_->{name} eq $vs)
Branch: 1 branch
BranchTrueFalseTotal
if $_->{"name"} eq $vs 0 0 0
2045 }
2046 }
2047  
2048 =head3 get_ltm_address_class_list ()
2049  
2050 Returns a list of all existing address classes.
2051  
2052 =cut
2053  
2054 0 ▶sub get_ltm_address_class_list {
Subroutine get_ltm_address_class_list: not called CC=1 SCAR=6.9
Pod documented
2055 0 return @{ $_[0]->_request(module => 'LocalLB', interface => 'Class', method => 'get_address_class_list') }
2056 }
2057  
2058 =head3 get_ltm_string_class_list ()
2059  
2060 Returns a list of all existing string classes.
2061  
2062 =cut
2063  
2064 0 ▶sub get_ltm_string_class_list {
Subroutine get_ltm_string_class_list: not called CC=1 SCAR=6.9
Pod documented
2065 0 return @{ $_[0]->_request(module => 'LocalLB', interface => 'Class', method => 'get_string_class_list') }
2066 }
2067  
2068 =head3 get_ltm_string_class ( $class_name )
2069  
2070 Return the specified LTM string class.
2071  
2072 =cut
2073  
2074 0 ▶sub get_ltm_string_class {
Subroutine get_ltm_string_class: not called CC=1 SCAR=6.9
Pod documented
2075 0 my ( $self, $class ) = @_;
2076 0 return @{ $self->_request(module => 'LocalLB', interface => 'Class', method => 'get_string_class', data => { class_names => [ $class ] } ) }[0]->{members}
2077 0 }
2078  
2079 =head3 get_ltm_string_class_members ( $class )
2080  
2081 Returns the specified LTM string class members.
2082  
2083 =cut
2084  
2085 0 ▶sub get_ltm_string_class_members {
Subroutine get_ltm_string_class_members: not called CC=1 SCAR=6.9
Pod documented
2086 0 my ( $self, $class ) = @_;
2087 return $self->_request( module => 'LocalLB', interface => 'Class', method => 'get_string_class_member_data_value', data => { class_members =>
2088 0 [ @{ $self->_request(module => 'LocalLB', interface => 'Class', method => 'get_string_class', data => { class_names => [ $class ] } ) }[0] ] } )
2089 }
2090  
2091 =head3 add_ltm_string_class_member ( $class, $member )
2092  
2093 Add the provided member to the specified class.
2094  
2095 =cut
2096  
2097 0 ▶sub add_ltm_string_class_member {
Subroutine add_ltm_string_class_member: not called CC=1 SCAR=6.9
Pod documented
2098 0 my ( $self, $class, $member ) = @_;
2099 0 $self->_request( module => 'LocalLB',
2100 interface => 'Class',
2101 method => 'add_string_class_member',
2102 data => {
2103 class_members => [
2104 {
2105 name => $class,
2106 members => [ $member ]
2107 }
2108 ]
2109 }
2110 )
2111 }
2112  
2113 =head3 delete_ltm_string_class_member ( $class, $member )
2114  
2115 Deletes the provided member from the specified class.
2116  
2117 =cut
2118  
2119 0 ▶sub delete_ltm_string_class_member {
Subroutine delete_ltm_string_class_member: not called CC=1 SCAR=6.9
Pod documented
2120 0 my ( $self, $class, $member ) = @_;
2121 0 $self->_request( module => 'LocalLB',
2122 interface => 'Class',
2123 method => 'delete_string_class_member',
2124 data => {
2125 class_members => [
2126 {
2127 name => $class,
2128 members => [ $member ]
2129 }
2130 ]
2131 }
2132 )
2133 }
2134  
2135 =head3 set_ltm_string_class_member ( $class, $member, value )
2136  
2137 Sets the value of the member to the provided value in the specified class.
2138  
2139 =cut
2140  
2141 0 ▶sub set_ltm_string_class_member {
Subroutine set_ltm_string_class_member: not called CC=1 SCAR=6.9
Pod documented
2142 0 my ( $self, $class, $member, $value ) = @_;
2143 0 $self->_request( module => 'LocalLB',
2144 interface => 'Class',
2145 method => 'set_string_class_member_data_value',
2146 data => {
2147 class_members => [
2148 {
2149 name => $class,
2150 members => [ $member ]
2151 }
2152 ],
2153 values => [
2154 [ $value ]
2155 ]
2156 }
2157 )
2158 }
2159  
2160 =head3 get_db_variable ( $VARIABLE )
2161  
2162 # Prints the value of the configsync.state database variable.
2163 print "Config state is " . $ic->get_db_variable('configsync.state') . "\n";
2164  
2165 Returns the value of the specified db variable.
2166  
2167 =cut
2168  
2169 0 ▶sub get_db_variable {
Subroutine get_db_variable: not called CC=1 SCAR=6.9
Pod documented
2170 0 my ($self,$var) = @_;
2171 0 return @{$self->_request(module => 'Management', interface => 'DBVariable', method => 'query', data => { variables => [$var] })}[0]->{value}
2172 0 }
2173  
2174 =head3 get_event_subscription_list
2175  
2176 Returns an array of event subscription IDs for all registered event subscriptions.
2177  
2178 =cut
2179  
2180 0 ▶sub get_event_subscription_list {
Subroutine get_event_subscription_list: not called CC=1 SCAR=6.9
Pod documented
2181 0 my ($self, %args)=@_;
2182 0 return $self->_request(module => 'Management', interface => 'EventSubscription', method => 'get_list');
2183 }
2184  
2185 =head3 get_event_subscription
2186  
2187 =cut
2188  
2189 0 ▶sub get_event_subscription {
Subroutine get_event_subscription: not called CC=1 SCAR=6.9
Pod documented
2190 0 my ($self, $id)=@_;
2191 0 return $self->_request(module => 'Management', interface => 'EventSubscription', method => 'query', data => { id_list => [$id] })
2192 }
2193  
2194 =head3 remove_event_subscription
2195  
2196 =cut
2197  
2198 0 ▶sub remove_event_subscription {
Subroutine remove_event_subscription: not called CC=1 SCAR=6.9
Pod documented
2199 0 my ($self, $id)=@_;
2200 0 return $self->_request(module => 'Management', interface => 'EventSubscription', method => 'remove', data => { id_list => [$id] })
2201 }
2202  
2203 =head3 get_event_subscription_state
2204  
2205 =cut
2206  
2207 0 ▶sub _get_event_subscription_state {
Subroutine _get_event_subscription_state: not called CC=1 SCAR=6.9
2208 0 my ($self,$id) = @_;
2209 0 return @{$self->_request(module => 'Management', interface => 'EventSubscription', method => 'get_state', data => { id_list => [$id] })}[0]
2210 }
2211  
2212 =head3 get_event_subscription_url
2213  
2214 =cut
2215  
2216 0 ▶sub get_event_subscription_url {
Subroutine get_event_subscription_url: not called CC=1 SCAR=6.9
Pod documented
2217 0 my ($self,$id) = @_;
2218 0 return @{$self->_request(module => 'Management', interface => 'EventSubscription', method => 'get_url', data => { id_list => [$id] })}[0]
2219 }
2220  
2221 0 ▶sub _get_event_subscription_proxy_url {
Subroutine _get_event_subscription_proxy_url: not called CC=1 SCAR=6.9
2222 0 my ($self,$id) = @_;
2223 0 return @{$self->_request(module => 'Management', interface => 'EventSubscription', method => 'get_proxy_url', data => { id_list => [$id] })}[0]
2224 }
2225  
2226 0 ▶sub _get_event_subscription_authentication {
Subroutine _get_event_subscription_authentication: not called CC=1 SCAR=6.9
2227 0 my ($self,$id) = @_;
2228 0 return @{$self->_request(module => 'Management', interface => 'EventSubscription', method => 'get_proxy_url', data => { id_list => [$id] })}[0]
2229 }
2230  
2231 0 ▶sub get_subscription_list {
Subroutine get_subscription_list: not called CC=2 SCAR=17.9
Pod documented
2232 0 my $self = shift;
2233 0 my @subs;
2234 0 foreach (@{$self->_request(module => 'Management', interface => 'EventSubscription', method => 'get_list')}){push @subs, $_}
2235 return @subs
2236 0 }
2237  
2238 =head3 get_subscription_list
2239  
2240 This method is an analog of B<get_event_subscription>
2241  
2242 =cut
2243  
2244 =head3 create_subscription_list (%args)
2245  
2246 my $subscription = $ic->create_subscription_list (
2247 name => 'my_subscription_name',
2248 url => 'http://company.com/my/eventnotification/endpoint,
2249 username => 'username',
2250 password => 'password',
2251 ttl => -1,
2252 min_events_per_timeslice => 10,
2253 max_timeslice => 10
2254 );
2255  
2256 Creates an event subscription with the target system. This method requires the following parameters:
2257  
2258 =over 3
2259  
2260 =item name
2261  
2262 A user-friendly name for the subscription.
2263  
2264 =item url
2265  
2266 The target URL endpoint for the event notification interface to send event notifications.
2267  
2268 =item username
2269  
2270 The basic authentication username required to access the URL endpoint.
2271  
2272 =item password
2273  
2274 The basic authentication password required to access the URL endpoint.
2275  
2276 =item ttl
2277  
2278 The time to live (in seconds) for this subscription. After the ttl is reached, the subscription
2279 will be removed from the system. A value of -1 indicates an infinite life time.
2280  
2281 =item min_events_per_timeslice
2282  
2283 The minimum number of events needed to trigger a notification. If this value is 50, then this
2284 means that when 50 events are queued up they will be sent to the notification endpoint no matter
2285 what the max_timeslice is set to.
2286  
2287 =item max_timeslice
2288  
2289 This maximum time to wait (in seconds) before event notifications are sent to the notification
2290 endpoint. If this value is 30, then after 30 seconds a notification will be sent with the events
2291 in the subscription queue.
2292  
2293 =back
2294  
2295 =cut
2296  
2297 0 ▶sub create_subscription_list {
Subroutine create_subscription_list: not called CC=9 SCAR=45.0
Pod documented
2298 0 my ($self, %args)=@_;
2299 0 ▶ $args{name} or return 'Request error: missing "name" parameter';
Branch: 1 branch
BranchTrueFalseTotal
$args{"name"} or return "Request error: missing \"name\" parameter" 0 0 0
2300 0 ▶ $args{url} or return 'Request error: missing "url" parameter';
Branch: 1 branch
BranchTrueFalseTotal
$args{"url"} or return "Request error: missing \"url\" parameter" 0 0 0
2301 #$args{username} or return 'Request error: missing "username" parameter';
2302 #$args{password} or return 'Request error: missing "password" parameter';
2303 0 ▶ $args{ttl} =~ /^(-)?\d+$/ or return 'Request error: missing or incorrect "ttl" parameter';
Branch: 1 branch
BranchTrueFalseTotal
$args{"ttl"} =~ /^(-)?\d+$/ or return "Request error: missing or incorrect \"ttl\" parameter" 0 0 0
2304 0 ▶ $args{min_events_per_timeslice} =~ /^(-)?\d+$/ or return 'Request error: missing or incorrect "min_events_per_timeslice" parameter';
Branch: 1 branch
BranchTrueFalseTotal
$args{"min_events_per_timeslice"} =~ /^(-)?\d+$/ or return "Request error: missing or incorrect \"min_events_per_timeslice\" parameter" 0 0 0
2305 0 ▶ $args{max_timeslice} =~ /^(-)?\d+$/ or return 'Request error: missing or incorrect "max_timeslice" parameter';
Branch: 1 branch
BranchTrueFalseTotal
$args{"max_timeslice"} =~ /^(-)?\d+$/ or return "Request error: missing or incorrect \"max_timeslice\" parameter" 0 0 0
2306 0 ▶ @{$args{event_type}} > 0 or return 'Request error: missing "event_type" parameter';
Branch: 1 branch
BranchTrueFalseTotal
@{$args{"event_type"};} > 0 or return "Request error: missing \"event_type\" parameter" 0 0 0
2307  
2308 0 foreach my $event (@{$args{event_type}}) {
2309 0 ▶ exists $event_types->{$event} or return "Request error: unknown \"event_type\" parameter \"$event\"";
Branch: 1 branch
BranchTrueFalseTotal
exists $BigIP::iControl::event_types->{$event} or return qq[Request error: unknown "event_type" parameter "$event"] 0 0 0
2310 }
2311  
2312 my $sub_detail_list= {
2313 name => $args{name},
2314 0 event_type_list => [@{$args{event_type}}],
2315 url => $args{url},
2316 url_credentials => {
2317 auth_mode => 'AUTHMODE_NONE',
2318 #username => $args{username},
2319 #password => $args{password}
2320 },
2321 ttl => $args{ttl},
2322 min_events_per_timeslice => $args{min_events_per_timeslice},
2323 max_timeslice => $args{max_timeslice},
2324 0 enabled_state => 'STATE_ENABLED'
2325 };
2326 0 return $self->_request(module => 'Management', interface => 'EventSubscription', method => 'create', data => {sub_detail_list => [$sub_detail_list]});
2327 }
2328  
2329 =head1 NOTES
2330  
2331 =head3 Statistic Methods
2332  
2333 Within iControl, statistical values are a 64-bit unsigned integer represented as a B<Common::ULong64> object.
2334 The ULong64 object is a stuct of two 32-bit values. This representation is used as there is no native
2335 support for the encoding of 64-bit numbers in SOAP.
2336  
2337 The ULong object has the following structure;
2338  
2339 ({
2340 STATISTIC_NAME => {
2341 high => long
2342 low => long
2343 }
2344 }, bless Common::ULong64)
2345  
2346 Where high is the unsigned 32-bit integer value of the high-order portion of the measured value and low is
2347 the unsigned 32-bit integer value of the low-order portion of the measured value.
2348  
2349 In non-stringified statistic methods, these return values are ULong64 objects as returned by the iControl API.
2350 In stringified statistic method calls, the values are processed on the client side into a local 64-bit representation
2351 of the value using the following form.
2352  
2353 $value = ($high<<32)|$low;
2354  
2355 Stringified method calls are guaranteed to return a correct localised 64-bit representation of the value.
2356  
2357 It is the callers responsibility to convert the ULong struct for all other non-stringified statistic method calls.
2358  
2359 =head1 AUTHOR
2360  
2361 Luke Poskitt, E<lt>ltp@cpan.orgE<gt>
2362  
2363 Thanks to Eric Welch, E<lt>erik.welch@gmail.comE<gt>, for input and feedback.
2364  
2365 =head1 LICENSE AND COPYRIGHT
2366  
2367 This program is free software; you can redistribute it and/or modify it
2368 under the terms of either: the GNU General Public License as published
2369 by the Free Software Foundation; or the Artistic License.
2370  
2371 See http://dev.perl.org/licenses/ for more information.
2372  
2373 =cut
2374  
2375 2 1;
↑ Summary