Agent-TCLI-Package-Net

 view release on metacpan or  search on metacpan

ex/target.t  view on Meta::CPAN

use Agent::TCLI::Testee;
use Agent::TCLI::Transport::XMPP;
use Agent::TCLI::Package::XMPP;
use Agent::TCLI::Package::Net::HTTP;

# Need to set up transport to talk to other Agents

# Packages for XMPP

# Within test scripts, we use diag() to output verbose messages
# to ensure we don't mess up the Test::Harness processing.
my @packages = (
	# We need the transport controller package to shut down the transport at the
	# end of the testing.
	Agent::TCLI::Package::XMPP->new,

	Agent::TCLI::Package::Net::HTTP->new,
);

# Need a transport to deliver the tests to remote hosts
Agent::TCLI::Transport::XMPP->new(

lib/Agent/TCLI/Package/Net/HTTP.pm  view on Meta::CPAN

  name: http
  call_style: session
  command: tcli_http
  contexts:
    ROOT: http
  handler: establish_context
  help: http web cient environment
  manual: >
    Currently the http commands available only support limited capabilities.
    One can request a url and verify that a desired response code was
    received, but HTML content is not processed.
  topic: net
  usage: http tget url=http:\example.com\request resp=404
---
Agent::TCLI::Command:
  name: tget
  call_style: session
  command: tcli_http
  contexts:
    http: tget
  handler: get

lib/Agent/TCLI/Package/Net/HTTPD.pm  view on Meta::CPAN

  constraints:
    - UINT
    -
      - BETWEEN
      - 1
      - 65535
  default: 8080
  help: A port to listen on
  manual: >
    Port sets the port used for the HTTPD to receive requests on.
    It must not already be in use by another process. If is is less
    than 1024, then the script must already be running as root or
    the HTTPD will fail to start. Port defaults to 8080.
  type: Param
  class: numeric
---
Agent::TCLI::Parameter:
  name: hostname
  constraints:
    - ASCII
  help: A hostname that the server will respond back with.

lib/Agent/TCLI/Package/Net/Ping.pm  view on Meta::CPAN

		$target->addr,
		$param->{'timeout'},
		$param->{'retry_count'},
  	);

	return($self->name.":ping done");
}

=item Pong

This POE Event handler receives and processes the events generated by
PoCo::Client::PIng and turns them in to appropriate Responses.

=back

=cut

sub Pong {
	my ($kernel,  $self, $ping, $pong) =
	  @_[KERNEL, OBJECT,  ARG0,  ARG1];

lib/Agent/TCLI/Package/Net/Traceroute.pm  view on Meta::CPAN

	$self->Verbose("_shutdown: ".$self->name." shutting down",2);
	$kernel->post('tracer' => 'shutdown');

	$kernel->alarm_remove_all();

	return($self->name.":_shutdown complete ");
}

=item trace

This POE event handler processes the trace command

=cut

sub trace {
    my ($kernel,  $self, $session, $request, ) =
      @_[KERNEL, OBJECT,  SESSION,     ARG0, ];

	my $txt = '';
	my $param;
	my $command = $request->command->[0];

lib/Agent/TCLI/Package/Net/Traceroute.pm  view on Meta::CPAN

#          MaxTTL    => 30,        # Override the global MaxTTL parameter
#          Callback  => [ $args ], # Data to send back with postback event
#        ]
    );

	return($self->name.":trace done");
}

=item TraceResponse

This POE event handler processes the return data from the PoCo::Client::Traceroute.

=cut

sub TraceResponse {
	my ($kernel,  $self, $trace, $reply) =
	  @_[KERNEL, OBJECT,   ARG0,  ARG1];

    my ($destination, $options, $callback) = @$trace;
    my ($hops, $data, $error)              = @$reply;

lib/Agent/TCLI/Package/Net/Traceroute.pm  view on Meta::CPAN

		}
	}

	$request->Respond($kernel, $txt, $code );

	return($self->name.":TraceResponse done");
}

=item TraceHopResponse

This POE event handler processes the per hop return data from the
PoCo::Client::Traceroute.

=cut

sub TraceHopResponse {
	my ($kernel,  $self, $trace, $reply) =
	  @_[KERNEL, OBJECT,   ARG0,  ARG1];

    my ($destination, $options, $callback) = @$trace;
    my ($hops, $data, $error)              = @$reply;

t/TCLI.Package.Net.HTTP.t  view on Meta::CPAN

#!/usr/bin/env perl
# $Id: TCLI.Package.Net.HTTP.t 61 2007-05-02 17:35:42Z hacker $

use Test::More qw(no_plan);
use lib 'blib/lib';
use warnings;
use strict;

use Getopt::Long;

# process options
my ($verbose,$poe_td,$poe_te);
eval { GetOptions (
  		"verbose+"		=> \$verbose,
  		"event_trace+"		=> \$poe_te,
  		"default_trace+"		=> \$poe_td,
)};
if($@) {die "ERROR: $@";}

$verbose = 0 unless defined($verbose);
$poe_td = 0 unless defined($poe_td);

t/TCLI.Package.Net.SMTP.t  view on Meta::CPAN

#!/usr/bin/env perl
# $Id: TCLI.Package.Net.SMTP.t 68 2007-06-06 18:13:38Z hacker $

use Test::More qw(no_plan);
use lib 'blib/lib';
use warnings;
use strict;

use Getopt::Long;

# process options
my ($verbose,$poe_td,$poe_te);
eval { GetOptions (
  		"verbose+"		=> \$verbose,
  		"event_trace+"		=> \$poe_te,
  		"default_trace+"		=> \$poe_td,
)};
if($@) {die "ERROR: $@";}

$verbose = 0 unless defined($verbose);
$poe_td = 0 unless defined($poe_td);

t/dev/TCLI.Package.Net.SMTP.Live.t  view on Meta::CPAN

# localhost at port 25. Without changes, it will generate emails
# to the author, which won't do anyone else much good.

use Test::More qw(no_plan);
use lib 'blib/lib';
use warnings;
use strict;

use Getopt::Long;

# process options
my ($verbose,$poe_td,$poe_te);
eval { GetOptions (
  		"verbose+"		=> \$verbose,
  		"event_trace+"		=> \$poe_te,
  		"default_trace+"		=> \$poe_td,
)};
if($@) {die "ERROR: $@";}

$verbose = 0 unless defined($verbose);
$poe_td = 0 unless defined($poe_td);

t/dev/target.t  view on Meta::CPAN

use Agent::TCLI::Testee;
use Agent::TCLI::Transport::XMPP;
use Agent::TCLI::Package::XMPP;
use Agent::TCLI::Package::Net::HTTP;

# Need to set up transport to talk to other Agents

# Packages for XMPP

# Within test scripts, we use diag() to output verbose messages
# to ensure we don't mess up the Test::Harness processing.
my @packages = (
	# We need the transport controller package to shut down the transport at the
	#end of the testing.
	Agent::TCLI::Package::XMPP->new(
	    'verbose'    => \$verbose ,
		'do_verbose'	=> sub { diag( @_ ) },
	),
	Agent::TCLI::Package::Net::HTTP->new({
		'verbose'		=> \$verbose,
		'do_verbose'	=> sub { diag( @_ ) },



( run in 0.374 second using v1.01-cache-2.11-cpan-8d75d55dd25 )