port search tries vlan edge port match first

This commit is contained in:
Oliver Gorwits
2012-01-12 19:24:54 +00:00
parent 8f6376be08
commit c6cea82685
3 changed files with 30 additions and 7 deletions

View File

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