Skip to content

Commit

Permalink
Add tests for inherit_vlan
Browse files Browse the repository at this point in the history
  • Loading branch information
jrouzierinverse authored and julsemaan committed Jan 8, 2021
1 parent 01ae738 commit fad8b6c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions t/data/roles.conf
Original file line number Diff line number Diff line change
@@ -1,10 1,13 @@
[r1]
inherit_vlan=enabled

[r2]
parent=r1
inherit_vlan=enabled

[r3]
parent=r2
acls=<<EOT
allow tcp 80
EOT
inherit_vlan=enabled
12 changes: 10 additions & 2 deletions t/unittest/Switch.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 22,12 @@ BEGIN {
use setup_test_config;
}

use Test::More tests => 8;
use Test::More tests => 14;
use pf::Switch;

#This test will running last
use Test::NoWarnings;
my $switch = pf::Switch->new();
my $switch = pf::Switch->new( { vlans => { r1 => "gotOne", r2 => "gotTwo" }, id => 'test' });

is(
$switch->extractSsid({'Called-Station-SSID' => 'Bob'}),
Expand Down Expand Up @@ -71,6 71,14 @@ is(
"getAccessListByName undef",
);

is(pf::Switch::_parentRoleForVlan("r3"), "r2", "parent role for vlan r3 is r2");
is(pf::Switch::_parentRoleForVlan("r2"), "r1", "parent role for vlan r2 is r1");
is(pf::Switch::_parentRoleForVlan("r1"), undef, "parent role for vlan r1 is undef");

is($switch->getVlanByName("r3"), "gotTwo", "Got the parent vlan");
is($switch->getVlanByName("r2"), "gotTwo", "Got my vlan");
is($switch->getVlanByName("r1"), "gotOne", "Got my vlan");

=head1 AUTHOR
Inverse inc. <[email protected]>
Expand Down

0 comments on commit fad8b6c

Please sign in to comment.