Skip to content

Commit

Permalink
adding increment_ip test
Browse files Browse the repository at this point in the history
  • Loading branch information
mbruns committed May 11, 2017
1 parent 1c2784f commit 7fa4232
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
2 changes: 1 addition & 1 deletion t/ipv6/Test_IPv6.pm
Expand Up @@ -87,7 +87,7 @@ sub adjust_testfile {

# Convert addresses.
# Several addresses might occur in one line, alter one at a time.
@matchcount = $line =~ /(\d+)\.\d+\.\d+\.\d+/;
@matchcount = $line =~ /\d+\.\d+\.\d+\.\d+/g;
if (@matchcount > 0){
my @words = split(/(\s+)/, $line);
for my $word (@words) {
Expand Down
49 changes: 49 additions & 0 deletions t/ipv6/ipv6.t
Expand Up @@ -42,6 +42,55 @@ END

test_run($title, $in, $out, '-ipv6');

#############################################################
$title = 'Check IPv6 increment_ip';
#############################################################

$in = <<'END';
network:n1 = { ip = 1000::0/16;
host:host1 = {
range = 1000::FFFF:FFFF:FFFF:FFFF:FFFF:FFF0 - 1000:0001::0;
}
}
network:n2 = { ip = 2000::0/48;
host:host2 = {
range = 2000::FFFF:FFFF:FFFF:FFF0 - 2000::0001:0000:0000:0000:0000;
}
}
network:n3 = { ip = 3000::0/80;
host:host3 = {
range = 3000::FFFF:FFF0 - 3000::0001:0000:0000;
}
}
router:r1 = {
managed;
model = IOS, FW;
interface:n1 = {ip = 1000::0001; hardware = E1;}
interface:n2 = {ip = 2000::0001; hardware = E2;}
interface:n3 = {ip = 3000::0001; hardware = E3;}
}
service:test1 = {
user = network:n1;
permit src = user;
dst = network:n2;
prt = tcp 80-90;
}
END

$out = <<'END';
-- r1
ip access-list extended E1_in
deny ip any host 2000::1
permit tcp 1000:: 0:ffff:ffff:ffff:ffff:ffff:ffff:ffff 2000:: ::ffff:ffff:ffff:ffff:ffff range 80 90
deny ip any any
END

test_run($title, $in, $out, '-ipv6');

#############################################################
$title = 'IPv6 with host ranges';
#############################################################
Expand Down
2 changes: 1 addition & 1 deletion t/ipv6/makefile
@@ -1,6 +1,6 @@
VPATH = ../

all : $(patsubst ../%.t, %_ipv6.t, $(wildcard ../*.t))
all : $(patsubst ../%.t, %_ipv6.t, $(filter-out ../ipv4.t, $(wildcard ../*.t)))

%_ipv6.t: %.t
perl convert.pl $^ .
Expand Down

0 comments on commit 7fa4232

Please sign in to comment.