Infoblox::Grid::Member::Capture::Control - Traffic capture control object


NAME

Infoblox::Grid::Member::Capture::Control - Traffic capture control object


DESCRIPTION

You can control traffic capture for a grid member via the settings in this object.


CONSTRUCTOR

 my $control = Infoblox::Grid::Member::Capture::Control->new(
               action         => "START" | "STOP",                       # Required
               interface      => "ALL" | "HA" | "LAN1" | "LAN2" | "MGMT",# Required
               seconds_to_run => $num,                                   # Required
 );


MODULE METHODS

The following functions are available to be applied to a traffic capture control object.

Infoblox::Grid::Member->traffic_capture( )

Use this function to control traffic capture for the Grid Member. See Infoblox::Grid::Member->traffic_capture() for parameters and return values. Note that the member object must be retrieved from the appliance in order for the traffic capture method to be available.


METHODS

This section describes all the methods that you can use to control traffic capture for a grid member.

action( )

Use this method to select the traffic capture action.

Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.

Parameter

Valid values are "START" or "STOP".

Returns

If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.

If you did not specify a parameter, the method returns the attribute value.

Example
   #Setting the action
   $control->action("START");

interface( )

Use this method to specify the interface on which you capture traffic.

Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.

Parameter

Valid values are "ALL", "HA", "LAN", "LAN2" or "MGMT".

Returns

If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.

If you did not specify a parameter, the method returns the attribute value.

Example
   #Choosing the interface
   $control->interface("ALL");

seconds_to_run( )

Use this method to select the number of seconds for which you want to run the traffic capture.

Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.

Parameter

Valid value is an integer specifying the number of seconds.

Returns

If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.

If you did not specify a parameter, the method returns the attribute value.

Example
   #Setting the capture interfal
   $control->seconds_to_run(5);


SAMPLE CODE

The following sample code demonstrates the different functions that can be applied to a capture control object. This sample also includes error handling for the operations.

#Preparation prior to traffic capture object operations

 #PROGRAM STARTS: Include all the modules that will be used
 use strict;
 use Infoblox;
 #Create a session to the Infoblox appliance
 my $session = Infoblox::Session->new(
     master   => "192.168.1.2",
     username => "admin",
     password => "infoblox"
 );
 unless ($session) {
    die("Construct session failed: ",
        Infoblox::status_code() . ":" . Infoblox::status_detail());
 }
 print "Session created successfully\n";

#Start traffic capture for a member

 # Get the grid member object.
 my $object = $session->get(
     object => "Infoblox::Grid::Member",
     name => "infoblox.localdomain",
 );
 unless ($object) {
       die("get grid member failed: ",
       $session->status_code() . ":" . $session->status_detail());
 }
 print "grid member get successful\n";
 my $capture = Infoblox::Grid::Member::Capture::Control->new(
                                                             action => 'START',
                                                             interface => 'ALL',
                                                             seconds_to_run => 2,
                                                            );
 unless ($object->traffic_capture($capture)) {
       die("traffic capture failed: ",
       $session->status_code() . ":" . $session->status_detail());
 }
 print "traffic capture started\n";
 ####PROGRAM ENDS####


AUTHOR

Infoblox Inc. http://www.infoblox.com/


SEE ALSO

Infoblox::Session, Infoblox::Grid::Member


COPYRIGHT

Copyright (c) 2017 Infoblox Inc.