allow port name to be changed on pseudo devices
This commit is contained in:
@@ -71,27 +71,29 @@ sub _set_port_generic {
|
|||||||
my $port = get_port($ip, $pn)
|
my $port = get_port($ip, $pn)
|
||||||
or return job_error("Unknown port name [$pn] on device [$ip]");
|
or return job_error("Unknown port name [$pn] on device [$ip]");
|
||||||
|
|
||||||
# snmp connect using rw community
|
if ($device->vendor ne 'netdisco') {
|
||||||
my $info = snmp_connect_rw($ip)
|
# snmp connect using rw community
|
||||||
or return job_error("Failed to connect to device [$ip] to control port");
|
my $info = snmp_connect_rw($ip)
|
||||||
|
or return job_error("Failed to connect to device [$ip] to control port");
|
||||||
|
|
||||||
my $iid = get_iid($info, $port)
|
my $iid = get_iid($info, $port)
|
||||||
or return job_error("Failed to get port ID for [$pn] from [$ip]");
|
or return job_error("Failed to get port ID for [$pn] from [$ip]");
|
||||||
|
|
||||||
my $method = 'set_i_'. $slot;
|
my $method = 'set_i_'. $slot;
|
||||||
my $rv = $info->$method($data, $iid);
|
my $rv = $info->$method($data, $iid);
|
||||||
|
|
||||||
if (!defined $rv) {
|
if (!defined $rv) {
|
||||||
return job_error(sprintf 'Failed to set [%s] %s to [%s] on [%s]: %s',
|
return job_error(sprintf 'Failed to set [%s] %s to [%s] on [%s]: %s',
|
||||||
$pn, $slot, $data, $ip, ($info->error || ''));
|
$pn, $slot, $data, $ip, ($info->error || ''));
|
||||||
}
|
}
|
||||||
|
|
||||||
# confirm the set happened
|
# confirm the set happened
|
||||||
$info->clear_cache;
|
$info->clear_cache;
|
||||||
my $check_method = 'i_'. $slot;
|
my $check_method = 'i_'. $slot;
|
||||||
my $state = ($info->$check_method($iid) || '');
|
my $state = ($info->$check_method($iid) || '');
|
||||||
if (ref {} ne ref $state or $state->{$iid} ne $data) {
|
if (ref {} ne ref $state or $state->{$iid} ne $data) {
|
||||||
return job_error("Verify of [$pn] $slot failed on [$ip]");
|
return job_error("Verify of [$pn] $slot failed on [$ip]");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# update netdisco DB
|
# update netdisco DB
|
||||||
|
|||||||
Reference in New Issue
Block a user