The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

IPDevice::RouterBase

SYNOPSIS

 use IPDevice::RouterBase;
 my $router = new IPDevice::RouterBase;
 $router->set_hostname('hostname');
 my $card = $router->card(0);
 $card->module(1);

DESCRIPTION

This module provides a base class, providing routines for storing informations regarding an IP router.

CONSTRUCTOR AND METHODS

new([%args])

Object constructor. Valid arguments:

hostname: The initial router hostname.

set_hostname($hostname)

Set the hostname.

get_hostname()

Returns the hostname.

set_vendor($vendor)

Defines the vendor.

get_vendor()

Returns the vendor.

set_model($model)

Defines the model name.

get_model()

Returns the model name.

set_os($os)

Defines the operating system name and version.

get_os()

Returns the operating system name and version.

set_cfgversion($version)

Defines the configuration version.

get_cfgversion()

Returns the configuration version.

card($cardnumber)

Returns the IPDevice::RouterBase::Card with the given number. If it does not exist, it will be created. If no card number is given, a virtual card will be returned anyway. You can, for example, add modules/interfaces that do not have a pysical card there.

isis()

Returns the IPDevice::RouterBase::ISIS instance. If that ISIS instance does not yet exist, a new one will be created/returned.

bgp($localas)

Returns the IPDevice::RouterBase::BGP instance with the given local as number. If that BGP instance does not yet exist, a new one will be created/returned.

prefixlist($name)

Returns the IPDevice::RouterBase::Prefixlist with the given name. If the IPDevice::RouterBase::Prefixlist does not exist yet, it will be created and returned.

add_staticroute($ip, $mask, $destination)

Add a new static route to the router. Returns the newly created IPDevice::RouterBase::StaticRoute.

get_staticroute($ip, $mask)

Returns the IPDevice::RouterBase::StaticRoute with the given ip and mask.

ip_host($name, $port)

Returns the IPDevice::RouterBase::IPHost with the given hostname/port. If it does not exist yet, a new one will be created.

foreach_ip_host($func, %data)

Walks through all hostname <-> IP mappings calling the function $func. Args passed to $func are:

$card: The IPDevice::RouterBase::IPHost. %data: The given data, just piped through.

If $func returns FALSE, the hostname <-> IP mapping list evaluation will be stopped.

foreach_bgp($func, %data)

Walks through all BGP instances calling the function $func. Args passed to $func are:

$card: The IPDevice::RouterBase::BGP. %data: The given data, just piped through.

If $func returns FALSE, the BGP instance list evaluation will be stopped.

foreach_prefixlist($func, %data)

Walks through all prefixlists calling the function $func. Args passed to $func are:

$pfxlist: The IPDevice::RouterBase::Prefixlist. %data: The given data, just piped through.

If $func returns FALSE, the list evaluation will be stopped.

foreach_card($func, %data)

Walks through all cards calling the function $func. Args passed to $func are:

$card: The IPDevice::RouterBase::Card. %data: The given data, just piped through.

If $func returns FALSE, the card list evaluation will be stopped.

foreach_module($func, %data)

Walks through all modules calling the function $func. Args passed to $func are:

$module: The IPDevice::RouterBase::Module. %data: The given data, just piped through.

If $func returns FALSE, the module list evaluation will be stopped.

foreach_interface($func, %data)

Walks through all interfaces calling the function $func. Args passed to $func are:

$interface: The IPDevice::RouterBase::Interface. %data: The given data, just piped through.

If $func returns FALSE, the interface list evaluation will be stopped.

foreach_unit($func, %data)

Walks through all IPDevice::RouterBase::LogicalInterface calling the function $func. Args passed to $func are:

$interface: The IPDevice::RouterBase::LogicalInterface. %data: The given data, just piped through.

If $func returns FALSE, list evaluation will be stopped.

COPYRIGHT

Copyright (c) 2004 Samuel Abels. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Samuel Abels <spam debain org>