perfSONAR_PS::Collectors::LinkStatus::Agent::Constant - This module provides an


perfSONAR_PS-Collectors-LinkStatus documentation Contained in the perfSONAR_PS-Collectors-LinkStatus distribution.

Index


Code Index:

NAME

Top

perfSONAR_PS::Collectors::LinkStatus::Agent::Constant - This module provides an agent for the Link Status Collector that simply returns a constant value.

DESCRIPTION

Top

When run, this agent will simply return the constant value its been configured to return along with the machine's current time.

API =cut

Top

new ($self, $status_type, $constant) Creates a new Constant Agent of the specified type and with the specified constant value. =cut

getType Returns the status type of this agent: admin or oper. =cut

setType ($self, $type) Sets the status type of this agent: admin or oper. =cut

setConstant ($self, $constant) Sets the constant value to be returned. =cut

getConstant ($self) Returns the constant value. =cut

run ($self) Returns the constant value that's been configured along with the current time of the machine its being run on. =cut

VERSION

Top

$Id:$

AUTHOR

Top

Aaron Brown, aaron@internet2.edu

LICENSE

Top

You should have received a copy of the Internet2 Intellectual Property Framework along with this software. If not, see <http://www.internet2.edu/membership/ip.html>

COPYRIGHT

Top


perfSONAR_PS-Collectors-LinkStatus documentation Contained in the perfSONAR_PS-Collectors-LinkStatus distribution.
package perfSONAR_PS::Collectors::LinkStatus::Agent::Constant;


use strict;
use warnings;

our $VERSION = 0.09;

use fields 'TYPE', 'CONSTANT';

sub new {
    my ($class, $type, $constant) = @_;

    my $self = fields::new($class);

    $self->{"TYPE"} = $type;
    $self->{"CONSTANT"} = $constant;

    return $self;
}

sub getType {
    my ($self) = @_;

    return $self->{TYPE};
}

sub setType {
    my ($self, $type) = @_;

    $self->{TYPE} = $type;

    return;
}

sub setConstant {
    my ($self, $constant) = @_;

    $self->{CONSTANT} = $constant;

    return;
}

sub getConstant {
    my ($self) = @_;

    return $self->{CONSTANT};
}

sub run {
    my ($self) = @_;

    my $time = time;

    if (not defined $self->{CONSTANT} or $self->{CONSTANT} eq "") {
        my $msg = "no constant defined";
        return (-1, $msg);
    }

    return (0, $time, $self->{CONSTANT});
}

1;

__END__

To join the 'perfSONAR-PS' mailing list, please visit:

https://mail.internet2.edu/wws/info/i2-perfsonar

The perfSONAR-PS subversion repository is located at:

https://svn.internet2.edu/svn/perfSONAR-PS

Questions and comments can be directed to the author, or the mailing list.  Bugs,
feature requests, and improvements can be directed here:

https://bugs.internet2.edu/jira/browse/PSPS

# vim: expandtab shiftwidth=4 tabstop=4