| perfSONAR_PS-Collectors-LinkStatus documentation | view source | Contained in the perfSONAR_PS-Collectors-LinkStatus distribution. |
perfSONAR_PS::Collectors::LinkStatus::Status - A module that provides an object describing the current status of a circuit.
This module is to be treated as an object representing the status of a circuit at a certain point in time. =cut
use strict; use warnings;
use fields 'TIME', 'OPER_STATE', 'ADMIN_STATE';
use perfSONAR_PS::Status::Common;
our $VERSION = 0.09;
sub new { my ($class, $time, $oper_state, $admin_state) = @_;
my $self = fields::new($class);
if (defined $time and $time ne "") {
$self->{"TIME"} = $time;
}
if (defined $oper_state and $oper_state ne "") {
if (isValidOperState($oper_state) == 0) {
return;
}
$self->{"OPER_STATE"} = $oper_state;
}
if (defined $admin_state and $admin_state ne "" and isValidAdminState($admin_state) == 0) {
if (isValidAdminState($admin_state) == 0) {
return;
}
$self->{"ADMIN_STATE"} = $admin_state;
}
return $self;
}
return $self->{TIME};
}
return $self->{OPER_STATE};
}
return $self->{ADMIN_STATE};
}
$self->{TIME} = $time;
return;
}
if (isValidOperState($oper_state) == 0) {
return -1;
}
$self->{OPER_STATE} = $oper_state;
return 0;
}
if (isValidAdminState($admin_state) == 0) {
return -1;
}
$self->{ADMIN_STATE} = $admin_state;
return 0;
}
if (isValidOperState($oper_state) == 0) {
return -1;
}
if (not defined $self->{OPER_STATE}) {
$self->{OPER_STATE} = $oper_state;
} elsif ($self->{OPER_STATE} eq "unknown" or $oper_state eq "unknown") {
$self->{OPER_STATE} = "unknown";
} elsif ($self->{OPER_STATE} eq "down" or $oper_state eq "down") {
$self->{OPER_STATE} = "down";
} elsif ($self->{OPER_STATE} eq "degraded" or $oper_state eq "degraded") {
$self->{OPER_STATE} = "degraded";
} elsif ($self->{OPER_STATE} eq "up" or $oper_state eq "up") {
$self->{OPER_STATE} = "up";
}
return 0;
}
if (isValidAdminState($admin_state) == 0) {
return -1;
}
if (not defined $self->{ADMIN_STATE}) {
$self->{ADMIN_STATE} = $admin_state;
} elsif ($self->{ADMIN_STATE} eq "unknown" or $admin_state eq "unknown") {
$self->{ADMIN_STATE} = "unknown";
} elsif ($self->{ADMIN_STATE} eq "maintenance" or $admin_state eq "maintenance") {
$self->{ADMIN_STATE} = "maintenance";
} elsif ($self->{ADMIN_STATE} eq "troubleshooting" or $admin_state eq "troubleshooting") {
$self->{ADMIN_STATE} = "troubleshooting";
} elsif ($self->{ADMIN_STATE} eq "underrepair" or $admin_state eq "underrepair") {
$self->{ADMIN_STATE} = "underrepair";
} elsif ($self->{ADMIN_STATE} eq "normaloperation" or $admin_state eq "normaloperation") {
$self->{ADMIN_STATE} = "normaloperation";
}
return 0;
}
1;
__END__ =head1 LICENSE
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 (c) 2004-2008, Internet2 and the University of Delaware
All rights reserved.
| perfSONAR_PS-Collectors-LinkStatus documentation | view source | Contained in the perfSONAR_PS-Collectors-LinkStatus distribution. |