now recognizes ranges, add git ignore, minor fix to parse.t, and bump to 0.1.0

This commit is contained in:
Zane C. B-H 2019-10-20 03:53:56 -05:00
parent a0761b7956
commit 349586d14e
4 changed files with 43 additions and 5 deletions

18
Net-DHCP-Windows-Netsh-Parse/.gitignore vendored Normal file
View File

@ -0,0 +1,18 @@
Makefile
Makefile.old
Build
Build.bat
META.*
MYMETA.*
.build/
_build/
cover_db/
blib/
inc/
.lwpcookies
.last_cover_stats
nytprof.out
pod2htm*.tmp
pm_to_blib
Net-DHCP-Config-Utilities-*
Net-DHCP-Config-Utilities-*.tar.gz

View File

@ -1,4 +1,9 @@
Revision history for Net-DHCP-Windows-Netsh-Parse
0.1.0 2918-10-20/03:50
- Now recognizes IP ranges and
adds them as a option.
- Minor correction to t/parse.t.
0.0.1 2019-10-14/03:45
- Initial release.

View File

@ -11,11 +11,11 @@ Net::DHCP::Windows::Netsh::Parse - Parses the output from 'netsh dhcp server dum
=head1 VERSION
Version 0.0.1
Version 0.1.0
=cut
our $VERSION = '0.0.1';
our $VERSION = '0.1.0';
=head1 SYNOPSIS
@ -143,6 +143,7 @@ sub parse{
$self->add_scope($server, $the_rest[1], $the_rest[2], $the_rest[3]);
}
}elsif( $command =~ /^[Ss]cope$/ ){
# Dhcp Server \\winboot Scope 10.31.129.248 Add iprange 10.31.129.251 10.31.129.254
# Dhcp Server \\winboot Scope 10.31.110.0 set optionvalue 51 DWORD "1800"
# Dhcp Server \\winboot Scope 10.31.110.0 set optionvalue 3 IPADDRESS "10.31.110.1"
my @the_rest=split(/\ +/, $the_rest);
@ -160,6 +161,12 @@ sub parse{
}
$self->add_option($server, $the_rest[0], $the_rest[3], \@values);
}elsif(
( $the_rest[1] eq 'Add' ) &&
( $the_rest[2] eq 'iprange' )
){
my @values=($the_rest[3].' '.$the_rest[4]);
$self->add_option($server, $the_rest[0], 'range', \@values);
}
}
}
@ -196,11 +203,21 @@ The structure of it is as below for both the return
hash ref or JSON.
$hostname=>{$scope}=>{
$options=>[],
$options=>{
$option_id=>[]
},
mask=>subnet mask,
desc=>description,
}
The $option_id will always be numeric, except for one special
case, which is range. That option contains a array of ranges
that the scope in question uses with in that subnet. Each item
the array represents one range. The format is as below for the
string.
$start_ip $end_ip
Hostname will always have \\ removed, so \\winboot
becomes just winboot.

View File

@ -4,8 +4,6 @@ use strict;
use warnings;
use Test::More;
plan tests => 8;
BEGIN {
use_ok( 'Net::DHCP::Windows::Netsh::Parse' ) || print "Bail out!\n";
}