App-Tel
view release on metacpan or search on metacpan
COMMANDS.md view on Meta::CPAN
the 'rtr' array instead of regexes. Here are some examples:
# you can use just the trailing octet:
{ 'regex' => '172.28.0.2-28', 'profile' => 'zhone_olt' },
# or the full IPv4 address:
{ 'regex' => '192.168.13.17-192.168.32.128', 'profile' => 'zhone_olt' },
# IPv6 is supported:
{ 'regex' => 'fe80::1-fe80::256', 'profile' => 'zhone_olt' },
# CIDR is also supported:
{ 'regex' => '192.168.13.0/24', 'profile' => 'zhone_olt' },
{ 'regex' => 'fe80::/64', 'profile' => 'zhone_olt' },
# comma separation is supported if you have multiple values that will load the
# same profile:
{ 'regex' => '192.168.13.17-192.168.32.128,172.16.0.2-172.16.0.13,172.28.0.0/24', 'profile' => 'zhone_olt' },
This allows you to load profiles by lists of IPs instead of DNS based
hostnames, which can be useful if your devices are spread out and your gear
isn't organized by DNS.
# wishlist
1. scrollback buffer across multiple sessions
lib/App/Tel/HostRange.pm view on Meta::CPAN
Returns true if the host is contained in the range, false if it is not.
This does no validation, leaving it all up to NetAddr:IP and the calling
function.
This should support the following types of ranges:
# 1. 192.168.13.17-192.168.32.128
# 2. 192.168.13.17-22
# 3. fe80::1-fe80::256
# 4. 192.168.13.0/24
# 5. fe80::/64
# 6. 192.168.13.17-192.168.32.128,172.16.0.2-172.16.0.13,172.28.0.0/24
# 7. 192.168.13.12
=cut
sub check_hostrange {
my ($rangelist, $host) = @_;
return 0 if (!$_have_netaddr);
$host = NetAddr::IP->new($host) || return 0;
local/lib/perl5/Module/Build/API.pod view on Meta::CPAN
perl Build.PL --Loud --Dbd=DBD::pg --Quantity --Quantity --Quantity
B<WARNING:> Any option specifications that conflict with Module::Build's own
options (defined by its properties) will throw an exception. Use capitalized
option names to avoid unintended conflicts with future Module::Build options.
Consult the Getopt::Long documentation for details on its usage.
=item include_dirs
[version 0.24]
Specifies any additional directories in which to search for C header
files. May be given as a string indicating a single directory, or as
a list reference indicating multiple directories.
=item install_path
[version 0.19]
You can set paths for individual installable elements by using the
t/05-hostrange.t view on Meta::CPAN
use warnings;
use lib qw(lib);
use Test::More;
use App::Tel::HostRange qw ( check_hostrange );
eval 'use NetAddr::IP; 1' ## no critic qw (BuiltinFunctions::ProhibitStringyEval)
or plan skip_all => 'Optional module NetAddr::IP required';
# 192.168.13.17-192.168.32.128
# fe80::1-fe80::256
# 192.168.13.0/24
# fe80::/64
# 192.168.13.17-192.168.32.128,172.16.0.2-172.16.0.13,172.28.0.0/24
is(check_hostrange('192.168.13.17-192.168.32.128,172.16.0.2-172.16.0.13,172.28.0.0/24', '192.168.13.16'), 0, 'Host out of range');
is(check_hostrange('192.168.13.17-192.168.32.128,172.16.0.2-172.16.0.13,172.28.0.0/24', '192.168.13.17'), 1, 'Host at edge of range');
is(check_hostrange('fe80::/64','192.168.13.16'), 0, 'IPv6 cidr, IPv4 host -- fail');
is(check_hostrange('fe80::/64','fe80::1'), 1, 'IPv6 cidr');
is(check_hostrange('fe80::/64','2607:f1e8::1'), 0, 'IPv6 cidr, incorrect range host fail');
is(check_hostrange('fe80::1-fe80::256','2607:f1e8::1'), 0, 'IPv6 range, incorrect host fail');
is(check_hostrange('fe80::1-fe80::256','fe80::1'), 1, 'IPv6 range, success');
is(check_hostrange('192.168.13.17-192.168.13.17','192.168.13.16'), 0, 'ipv4 range fail');
is(check_hostrange('192.168.13.17-192.168.13.17','192.168.13.17'), 1, 'ipv4 range success');
is(check_hostrange('192.168.13.17-192.168.13.17','192.168.13.18'), 0, 'ipv4 range fail');
is(check_hostrange('fe80::1/128,fe80::2/128,192.168.13.17-192.168.13.128','192.168.13.18'), 1, 'mixed ipv4/ipv6 range cidr success');
is(check_hostrange('fe80::1/128,fe80::2/128,192.168.13.17-192.168.13.128','192.168.13.1'), 0, 'mixed range/cidr fail');
( run in 0.428 second using v1.01-cache-2.11-cpan-88abd93f124 )