perfSONAR_PS::Status::Common - A module that provides common methods for Link


perfSONAR_PS-Status-Common documentation Contained in the perfSONAR_PS-Status-Common distribution.

Index


Code Index:

NAME

Top

perfSONAR_PS::Status::Common - A module that provides common methods for Link Status clients and services within the perfSONAR-PS framework.

DESCRIPTION

Top

This module is a catch all for common methods (for now) in the Link Status port of the perfSONAR-PS framework. This module IS NOT an object, and the methods can be invoked directly.

SYNOPSIS

Top

DETAILS

Top

The API for this module aims to be simple; note that this is not an object and each method does not have the 'self knowledge' of variables that may travel between functions.

API

Top

The API of perfSONAR_PS::Status::Common offers simple calls to common activities in the perfSONAR-PS framework.

isValidAdminState($state)

Checks if the given string is a valid administrative state for a link.

isValidOperState($state)

Checks if the given string is a valid operational state for a link.

SEE ALSO

Top

Exporter

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.

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-Status-Common documentation Contained in the perfSONAR_PS-Status-Common distribution.

package perfSONAR_PS::Status::Common;

use strict;
use warnings;

our $VERSION = 0.09;

use base 'Exporter';

our @EXPORT = ('isValidOperState', 'isValidAdminState');

my %valid_oper_states = (
        up => '',
        down => '',
        degraded => '',
        unknown => '',
        );

my %valid_admin_states = (
        normaloperation => '',
        maintenance => '',
        troubleshooting => '',
        underrepair => '',
        unknown => '',
        );

sub isValidOperState {
    my ($state) = @_;
    return 1 if (defined $valid_oper_states{lc($state)});
    return 0;
}

sub isValidAdminState {
    my ($state) = @_;
    return 1 if (defined $valid_admin_states{lc($state)});
    return 0;
}

1;

__END__

# vim: expandtab shiftwidth=4 tabstop=4