The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

perfSONAR_PS::Services::MP::Config::PingER - Configuration module for the support of scheduled tests for PingER

DESCRIPTION

This class inherits perfSONAR_PS::MP::Config::Schedule in order to provide an interface to the test periods and offsets defined for PingER tests.

In this implementation, we only handle the topology-like PingER schema.

SYNOPSIS

  # create the configuration object
  my $schedule = perfSONAR_PS::Services::MP::Config::PingER->new();

  # set the configuration file to use (note that the definitions of how to
  # parse for the appropriate test periods, and offset times etc for the 
  #individual tests should be defined in an inherited class.
  $schedule->configFile( 'some-config-file-path' ); 
  if ( $schedule->load() == 0 ) {

        # get a list of the test id's to run
        my @testids = $schedule->getAllTestIds();
        
        # determine the period of time from now until the next test should run
        my $time = $schedule->getTestTimeFromNow( $testids[0] );

    print "The next test for '$testid' will run in $time seconds from now.";

  } else {

        print "Something went wrong with parsing file '" . $schedule->configFile() . "'\n";
    return -1;

  }

new

constructor for object

configFile

accessor/mutator method for the configuration file

config

accessor/mutator method for the configuration

getAllTestIds()

Returns a list of all the testids that have been parsed.

load( $file )

Loads and parses the configuration file with schedule information '$file'. If no argument is passed, then will use the file defined in accessor/mutator $self->configFile().

Returns 0 = everything parsed okay -1 = parsing and or loading failed.

getTestById( $testid )

Returns the test information for $testid. Datastructure is a hash of the following format

$hash->{$testid}->{packetSize} = n (bytes) $hash->{$testid}->{count} = n (packets) $hash->{$testid}->{ttl} = n (hops) $hash->{$testid}->{interval} = n (secs) $hash->{$testid}->{offset} = n (secs) $hash->{$testid}->{measurementPeriod} = n (secs) $hash->{$testid}->{measurementOffset} = n (secs)

getTextNextTimeFromNow( $testid )

Determines the amonut of time from now until the next test for $testid should start.

Returns n = seconds til next test undef = testid does not exist