Send Netdot-devel mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://osl.uoregon.edu/mailman/listinfo/netdot-devel
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Netdot-devel digest..."
Today's Topics:
1. [SCM] Netdot branch master updated. netdot-1.0.4-117-g166d9b6
([email protected])
2. [SCM] Netdot branch netdot-1.0 updated.
netdot-1.0.4-117-g166d9b6 ([email protected])
----------------------------------------------------------------------
Message: 1
Date: Wed, 6 Nov 2013 12:52:56 -0800
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch master updated.
netdot-1.0.4-117-g166d9b6
To: [email protected]
Message-ID: <[email protected]>
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Netdot".
The branch, master has been updated
via 166d9b6886c091f007a35bee09b314444b5f11c1 (commit)
from 82c2a0df2d9f919579c98a4d11854f0b0a79d834 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 166d9b6886c091f007a35bee09b314444b5f11c1
Author: Carlos Vicente <[email protected]>
Date: Tue Nov 5 21:53:35 2013 -0500
Provide drop-downs to select various SNMP parameters in the device page
diff --git a/htdocs/management/device.html b/htdocs/management/device.html
index 80dc04c..c46da87 100644
--- a/htdocs/management/device.html
+++ b/htdocs/management/device.html
@@ -548,17 +548,34 @@ $ui->add_to_fields(o=>$o, edit=>0,
fields=>['ipforwarding'],
if ( $o->snmp_managed ){
- my @fields = ('snmp_version', 'community', 'snmp_bulk', 'canautoupdate',
'snmp_polling',
- 'collect_arp', 'collect_fwt', 'collect_stp',
'snmp_conn_attempts', 'snmp_down');
- $ui->add_to_fields(o=>$o, edit=>$editmgmt, fields=>\@fields,
field_headers=>\@field_headers, cell_data=>\@cell_data);
-
- @fields = ('last_arp', 'last_fwt');
- $ui->add_to_fields(o=>$o, edit=>0, fields=>\@fields,
field_headers=>\@field_headers, cell_data=>\@cell_data);
-}
-if ( $o->snmp_version eq "3" ){
- my @fields = ('snmp_authkey', 'snmp_authprotocol', 'snmp_privkey',
'snmp_privprotocol', 'snmp_securitylevel',
- 'snmp_securityname' );
- $ui->add_to_fields(o=>$o, edit=>$editmgmt, fields=>\@fields,
field_headers=>\@field_headers, cell_data=>\@cell_data);
+
+ $ui->add_to_fields(o=>$o, edit=>$editmgmt, fields=>['snmp_version'],
defaults=>[['1','2','3']],
+ field_headers=>\@field_headers, cell_data=>\@cell_data);
+
+ my @fields = ('snmp_bulk', 'canautoupdate', 'snmp_polling', 'collect_arp',
'collect_fwt',
+ 'collect_stp', 'snmp_conn_attempts', 'snmp_down');
+ $ui->add_to_fields(o=>$o, edit=>$editmgmt, fields=>\@fields,
field_headers=>\@field_headers,
+ cell_data=>\@cell_data);
+
+ # These can't be edited
+ $ui->add_to_fields(o=>$o, edit=>0, fields=>['last_arp', 'last_fwt'],
+ field_headers=>\@field_headers, cell_data=>\@cell_data);
+
+ if ( $o->snmp_version eq "3" ){
+ my @auth_protocols = ('MD5', 'SHA');
+ my @priv_protocols = ('AES', 'DES');
+ my @sec_levels = ('noAuthNoPriv', 'authNoPriv', 'authPriv');
+
+ my @fields = ('snmp_authkey', 'snmp_authprotocol', 'snmp_privkey',
'snmp_privprotocol', 'snmp_securitylevel',
+ 'snmp_securityname' );
+ $ui->add_to_fields(
+ o=>$o, edit=>$editmgmt, fields=>\@fields,
field_headers=>\@field_headers, cell_data=>\@cell_data,
+ defaults=>['', \@auth_protocols, '', \@priv_protocols,
\@sec_levels, ''],
+ );
+ }else{
+ $ui->add_to_fields(o=>$o, edit=>0, fields=>['community'],
field_headers=>\@field_headers,
+ cell_data=>\@cell_data);
+ }
}
# Add the snmp_target IP. We want to show only the device IPs when editing
diff --git a/lib/Netdot/UI.pm b/lib/Netdot/UI.pm
index eeabf31..70ee933 100644
--- a/lib/Netdot/UI.pm
+++ b/lib/Netdot/UI.pm
@@ -936,23 +936,37 @@ sub text_field($@){
my $input_type = ($column =~ /^password|snmp_authkey|snmp_privkey$/)?
'password' : 'text';
if ( $isEditing ){
- if ( $defaults && ref($defaults) eq "HASH" ){
+ if ( $defaults ){
# Show a select tag instead
$output .= "<select name=\"$name\">";
$output .= '<option value=""></option>';
my $value_found = 0;
- foreach my $key ( sort { $defaults->{$a} cmp $defaults->{$b} }
- keys %$defaults ){
- my $v = $defaults->{$key};
- if ( $value eq $key ){
- $output .= "<option value=\"$key\" SELECTED>$v</option>";
- $value_found = 1;
- }else{
- $output .= "<option value=\"$key\">$v</option>";
+ if ( ref($defaults) eq "HASH" ){
+ foreach my $key ( sort { $defaults->{$a} cmp $defaults->{$b} }
+ keys %$defaults ){
+ my $v = $defaults->{$key};
+ if ( $value eq $key ){
+ $output .= "<option value=\"$key\"
SELECTED>$v</option>";
+ $value_found = 1;
+ }else{
+ $output .= "<option value=\"$key\">$v</option>";
+ }
+ }
+ if ( !$value_found && $value ne "" ){
+ $output .= "<option value=\"$value\"
SELECTED>$value</option>";
+ }
+ }elsif ( ref($defaults) eq 'ARRAY' ){
+ foreach my $v ( sort @$defaults ){
+ if ( $value eq $v ){
+ $output .= "<option value=\"$v\" SELECTED>$v</option>";
+ $value_found = 1;
+ }else{
+ $output .= "<option value=\"$v\">$v</option>";
+ }
+ }
+ if ( !$value_found && $value ne "" ){
+ $output .= "<option value=\"$value\"
SELECTED>$value</option>";
}
- }
- if ( !$value_found && $value ne "" ){
- $output .= "<option value=\"$value\" SELECTED>$value</option>";
}
$output .= '</select>';
}else{
-----------------------------------------------------------------------
Summary of changes:
htdocs/management/device.html | 39 ++++++++++++++++++++++++++++-----------
lib/Netdot/UI.pm | 38 ++++++++++++++++++++++++++------------
2 files changed, 54 insertions(+), 23 deletions(-)
hooks/post-receive
--
Netdot
------------------------------
Message: 2
Date: Wed, 6 Nov 2013 12:53:25 -0800
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch netdot-1.0 updated.
netdot-1.0.4-117-g166d9b6
To: [email protected]
Message-ID: <[email protected]>
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Netdot".
The branch, netdot-1.0 has been updated
via 166d9b6886c091f007a35bee09b314444b5f11c1 (commit)
from 82c2a0df2d9f919579c98a4d11854f0b0a79d834 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
htdocs/management/device.html | 39 ++++++++++++++++++++++++++++-----------
lib/Netdot/UI.pm | 38 ++++++++++++++++++++++++++------------
2 files changed, 54 insertions(+), 23 deletions(-)
hooks/post-receive
--
Netdot
------------------------------
_______________________________________________
Netdot-devel mailing list
[email protected]
https://osl.uoregon.edu/mailman/listinfo/netdot-devel
End of Netdot-devel Digest, Vol 80, Issue 5
*******************************************