implement ports list filtering

This commit is contained in:
Oliver Gorwits
2012-01-12 22:19:17 +00:00
parent e817220856
commit f1eb6eb201
5 changed files with 48 additions and 7 deletions

View File

@@ -64,7 +64,7 @@ sub by_name {
# should match edge ports only
sub by_vlan {
my ($set, $vlan) = @_;
return $set unless $vlan and $vlan =~ m/^\d+$/;;
return $set unless $vlan and $vlan =~ m/^\d+$/;
return $set->search(
{
@@ -78,5 +78,21 @@ sub by_vlan {
);
}
sub by_port {
my ($set, $port) = @_;
return $set unless $port;
return $set->search(
{
'me.port' => $port,
},
{
order_by => [qw/ me.ip me.port /],
columns => [qw/ ip port descr name vlan device.dns /],
join => 'device',
},
);
}
1;