#490 use new checks for uplink and phone on port
This commit is contained in:
@@ -105,7 +105,8 @@ sub port_reconfig_check {
|
|||||||
|
|
||||||
# uplink check
|
# uplink check
|
||||||
return "forbidden: port [$name] on [$ip] is an uplink"
|
return "forbidden: port [$name] on [$ip] is an uplink"
|
||||||
if $port->remote_type and not $has_phone and not setting('portctl_uplinks');
|
if ($port->is_uplink or $port->remote_type)
|
||||||
|
and not $has_phone and not setting('portctl_uplinks');
|
||||||
|
|
||||||
# phone check
|
# phone check
|
||||||
return "forbidden: port [$name] on [$ip] is a phone"
|
return "forbidden: port [$name] on [$ip] is a phone"
|
||||||
@@ -215,18 +216,10 @@ sub is_vlan_interface {
|
|||||||
|
|
||||||
Returns true if the C<$port> L<DBIx::Class> object has a phone connected.
|
Returns true if the C<$port> L<DBIx::Class> object has a phone connected.
|
||||||
|
|
||||||
This uses a simple check on the I<type> of the remote connected device, and
|
|
||||||
therefore might sometimes return a false-negative result.
|
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub port_has_phone {
|
sub port_has_phone {
|
||||||
my $port = shift;
|
return (shift)->with_properties->remote_is_phone;
|
||||||
|
|
||||||
my $has_phone = ($port->remote_type
|
|
||||||
and $port->remote_type =~ /ip.phone/i) ? 1 : 0;
|
|
||||||
|
|
||||||
return $has_phone;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|||||||
Reference in New Issue
Block a user